我只想确认我拥有的其中一个视图的后退导航。具体的视图是一个 UICollectionViewController。我知道我在 if 语句中的确切编码不正确。我不太确定该怎么做。帮我填空?
集合视图控制器.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
BOOL isThisViewACollectionView = YES;
}
-(void) viewWillDisappear:(BOOL)animated {
if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
// back button was pressed. We know this is true because self is no longer
// in the navigation stack.
if (isThisViewACollectionView) {
UIAlertView *cameraAlertView = [[UIAlertView alloc] initWithTitle:@"Camera Not Available" message:@"The camera feature isn't available on your device." delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[cameraAlertView show];
}
}else{
[super viewWillDisappear:animated];
}
}