Call [self.window bringSubviewToFront:btn_Browse];
after receiving view removed delegate call or dismissing views.
UIButton Not visible after cancel from mail , message from UIActivityViewController
-
02-08-2022 - |
Question
In my project I have added UIButton
s on window. I am using UIActivityViewController
for sharing. When I cancel mail or message my UIButton
s 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
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow