multiple views navigation in UIPopovercontroller

≯℡__Kan透↙ 提交于 2019-12-25 05:08:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!