2012-04-27 46 views
0

我在主視圖中有一個按鈕..當她點擊那個按鈕時,它穿着popoverview,在彈出窗口中有一個uiviewcontrolle,當用戶點擊它在導航到的popover中的tableviewcell時頁面,然後用戶點擊下一頁的任何按鈕,,,它導航到另一個視圖,所有內部彈出..一切工作正常..但在這裏在我最後的看法...我需要去主頁, ,但我可以看到popover中的主頁面,我想解僱popover並轉到主頁面,我嘗試了許多解決方案,但對我來說沒有任何作用,這是關於這個問題的我的secod問題...... plz hale me to do第一個問題的鏈接是first question there is my codeUIPopovercontroller中的多個視圖導航

回答

0

在主視圖的viewDidLoad中添加通知

0在主視圖
[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(dismissThePopover:) 
              name:@"dismissThePopover" 
              object:nil]; 

寫功能

-(void)dismissThePopover:(id)sender 
{ 
    if ([popoverController isPopoverVisible]) { 
      [popoverController dismissPopoverAnimated:YES]; 
     } 
} 

最後發佈從其中u具有駁回酥料餅的控制器的通知,就像

-(IBAction)cancelButtonPressed:(id)sender 
{ 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissThePopover" object:nil]; 
}