私はスイッチビューをやろうとしています。私の最初のビューはストーリーボードで、view2 に切り替えたいのですが、最初のビューでボタンをクリックしても問題ありません。問題は、戻ろうとすると画面が真っ暗になり、最初のビューに戻らないことです。ここで私が使用しているコード。
ViewController.h
- (IBAction)View2:(id)sender;
ViewController.m
- (IBAction)View2:(id)sender {
View2 *second = [[View2 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
そして、ここでは、2 番目のビューから最初のビューに戻るために使用しているコードを示します。
view2.h
- (IBAction)back:(id)sender;
View2.m
- (IBAction)back:(id)sender {
ViewController *second = [[ViewController2 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
私はある種のエラーをしていますか?
ありがとう