このカスタムの戻るボタンがあります:
- (IBAction)backToMenu:(id)sender {
[self.presentingViewController dismissModalViewControllerAnimated:YES];
}
iOS 6 シミュレーターでアプリをテストすると、dismissModalViewControllerAnimated は非推奨であると表示されます。代わりに、dismissViewControllerAnimated を使用する必要があるため、iOS 6 コードを使用して iOS 5 にフォールバックする方法
私はこれを試しました:
if([self respondsToSelector:@selector(presentingViewController:animated:completion:)])
[self.presentingViewController dismissViewControllerAnimated:(YES) completion:nil];
else if([self respondsToSelector:@selector(presentingViewController:animated:)])
[self.presentingViewController dismissModalViewControllerAnimated:YES];
else
NSLog(@"Oooops, what system is this ?!!! - should never see this !");
しかし、結果がなければ、NSLog が表示され、ビューが閉じられません。ヒントはありますか?
前もって感謝します。