Question

In my project I have added UIButtons on window. I am using UIActivityViewController for sharing. When I cancel mail or message my UIButtons are not visible.

Add UIbutton on window:

    UIImage  *tempImage   = [UIImage imageNamed:@"browse_menu.png"];
btn_Browse  = [UIButton buttonWithType:UIButtonTypeCustom];
btn_Browse.frame      = CGRectMake(0.0, self.window.frame.size.height-tempImage.size.height, tempImage.size.width, tempImage.size.height);
//[btn_Browse addTarget:self action:@selector(createCustomView) forControlEvents:UIControlEventTouchDown];
[btn_Browse setBackgroundImage:tempImage forState:UIControlStateNormal];
[btn_Browse addTarget:self action:@selector(browseButtonClicked:) forControlEvents:UIControlEventTouchDown];
btn_Browse.tag = 0;
[self.window addSubview:btn_Browse];

Present UIActivityViewcontroller:

NSString *msg_store=[NSString stringWithFormat:@"HI - %@ ",lbl_name.text];
NSString *msg=[msg_store stringByAppendingString:[NSString stringWithFormat:@"Welocome! %@",app_Url]];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc]initWithActivityItems:[NSArray arrayWithObjects:msg,nil] applicationActivities:nil];
activityViewController.completionHandler = ^(NSString *activityType, BOOL completed){
    NSLog(@"Activity Type selected: %@", activityType);
    if (completed) {
        NSLog(@"Selected activity was performed.");
    } else {
        if (activityType == NULL) {
            NSLog(@"User dismissed the view controller without making a selection.");
        } else {
            NSLog(@"Activity was not performed.");
        }
    }
};
 [self presentViewController:activityViewController animated:YES completion:nil];  

Thanks in advance

Was it helpful?

Solution

Call [self.window bringSubviewToFront:btn_Browse]; after receiving view removed delegate call or dismissing views.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top