问题
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];
}
来源:https://stackoverflow.com/questions/10346207/multiple-views-navigation-in-uipopovercontroller