我想顯示圖像以響應iPhone鎖定時發生的本地通知事件。當用戶在通知上滑動時,我希望我的應用程序通過popToViewController進入根視圖控制器:animated,然後推送顯示圖像的視圖控制器。這適用於我設置動畫= YES。當animated = NO時,顯示圖像的視圖控制器在用戶點擊後退按鈕時不響應。任何想法爲什麼圖像視圖控制器的導航控件不起作用時,我popToViewController沒有動畫?提前致謝。如何在沒有動畫的情況下彈出到視圖控制器
下面是相關的代碼...
- (void) localNotificationHandler
{
#ifdef kAnimatePop
animated = YES; // This works
#else
animated = NO; // This doesn't work
#endif
_showImage = YES;
// Check if this view controller is not visible
if (self.navigationController.visibleViewController != self) {
// Check if there are view controllers on the stack
if ([self.navigationController.viewControllers count] > 1) {
// Make this view controller visible
[self.navigationController popToViewController:self animated:animated];
}
}
}
- (void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if (_showImage) {
_showImage = NO;
// Show image in a view controller
[self performSegueWithIdentifier:@"MainToImageSegue" sender:self];
}
}
感謝您的回答,但這不會導致問題。我會編輯我的代碼以避免混淆。 – 0x141E