i have a button in the main view ..when the her tap that button it shoes the popoverview ,inside the popover i have a uiviewcontrolle,when the user tap the tableviewcell inside the popover it navigate to next page,,then the user tap any button of the next page ,,,it navigate to another view,all are inside popover..everything works fine..but here in my last view...i need to go to main page,,but i can see the main page inside the popover,i want to dismiss that popover and go tot main page,i tried many solutions nothing work for me,,this is my secod question regarding this issue...plz hale me to do this..the link of the first question isfirst question there is my code
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Add a notification in main view's viewDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(dismissThePopover:)
name:@"dismissThePopover"
object:nil];
write function in Main view
-(void)dismissThePopover:(id)sender
{
if ([popoverController isPopoverVisible]) {
[popoverController dismissPopoverAnimated:YES];
}
}
and finally post the notification from where u have to dismiss the popover controller, like
-(IBAction)cancelButtonPressed:(id)sender
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"dismissThePopover" object:nil];
}