4 개의보기가있는 앱이 있습니다. HomeView, PreGameView, GameView, PostGameView. 응용 프로그램은 HomeView에서 시작하는 방식으로 작동합니다. 그런 다음 PreGameView로 이동하는 시작을 클릭하고, GameView로 나를 데려가는 시작을 클릭하고, 최종 게임에서 PostGameView로 이동합니다.이 게임을 통해 다시 돌아갈 수 있습니다. GameView 또는 HomeView로 돌아갑니다.presentModalViewController를 올바르게 사용하고 있습니까? 도움?
"presentModalViewController"메서드를 사용하여 이러한 뷰를 레이어합니다. 그러나 PostGameView까지 모든 레이어를 쌓은 다음 HomeView로 돌아 가려고 결정하면 화면이 그냥 흰색으로 바뀝니다.
나는 또한 다음을 제시하기 전에 각 modelview를 해고하려고 시도했지만 작동하지 않으며 앱이 모두 혼란스러워집니다. 누구든지 올바른 방법을 알고 있습니까? 도와주세요?
HomeView.m
- (IBAction)loadPreGameView:(id)sender {
PreGameView *preGameView = [[PreGameView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:preGameView animated:YES];
}
PreGameView.m
- (IBAction)loadGameView:(id)sender {
GameView *gameView = [[GameView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:gameView animated:NO];
}
GameView.m
- (IBAction)loadPostGameView:(id)sender {
PostGameView *postGameView = [[PostGameView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:postGameView animated:NO];
}
PostGameView.m
- (IBAction)loadGameView:(id)sender {
GameView *gameView = [[GameView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:gameView animated:NO];
}
- (IBAction)loadHomeView:(id)sender {
HomeView *homeView = [[HomeView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:homeView animated:NO];
}
나는 또한 내 PostGameView.m의 아래를했지만, 그것은 단지 뒤에 GameView 보여 주었다 :
PostGameView.m (구)
- (IBAction)loadGameView:(id)sender {
GameView *gameView = [[GameView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:gameView animated:NO];
}
- (IBAction)loadHomeView:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
하지만 내가 [self dismissModalViewControllerAnimated : NO] 할 때; GameView * gameView = [[GameView alloc] initWithNibName : nil 번들 : nil]; PreGameView.m에서 [self presentModalViewController : gameView animated : NO];'보기는 GameView가 아닌 PreGameView에서 다시 HomeView로 돌아갑니다. – buzzkip