複数のモーダル ビュー コントローラーを含む野球ゲーム アプリに取り組んでいます。ただし、「BasicGameSetupViewController」から「BasicViewController」へのモーダル遷移を行うと、(BasicViewController の ViewDidLoad メソッド内に NSLog ステートメントがあるため)遷移が発生しますが、実際のビューは更新されません。BasicViewController に移行する方法を次に示します (このコードは BasicGameSetupViewController にあります)。
- (IBAction)pressedBeginPlay:(id)sender {
numOfInnings = [selectInnings selectedSegmentIndex];
numOfInnings = numOfInnings + 1;
row = [teamSelector selectedRowInComponent:0];
visitor = [teams objectAtIndex:row];
row = [teamSelector selectedRowInComponent:1];
home = [teams objectAtIndex:row];
NSLog(@"%@", visitor);
NSLog(@"%@", home);
if([awaySelect selectedSegmentIndex] == 0)
{
awayPlayer = @"Human";
}
else
{
awayPlayer = @"CPU";
}
if([homeSelect selectedSegmentIndex] == 0)
{
homePlayer = @"Human";
}
else
{
homePlayer = @"CPU";
}
[self performSegueWithIdentifier:@"startBeginnerToBasic" sender:self];
}
(このブロックには「prepareForSegue」メソッドもあります) BasicViewController の viewDidLoad メソッドは次のとおりです。
- (void)viewDidLoad{
NSLog(@"Made it to basic View controller");
homeLineup = [[NSMutableArray alloc] initWithCapacity:9];
visitorLineup = [[NSMutableArray alloc] initWithCapacity:9];
batter = [[NSMutableArray alloc] initWithCapacity:22];
homePitcher = [[NSMutableArray alloc] initWithCapacity:22];
awayPitcher = [[NSMutableArray alloc] initWithCapacity:22];
pitcher = [[NSMutableArray alloc] initWithCapacity:22];
homeAlreadyPitched = [[NSMutableArray alloc]initWithCapacity:5];
awayAlreadyPitched = [[NSMutableArray alloc] initWithCapacity:5];
NSLog(@"arrays initialized");
[super viewDidLoad];
[self setUpTeams];
[self checkForComputer];
[self newBatter];
[self atBat];
// Do any additional setup after loading the view.
}
ビューが表示されない理由について、私は完全に困惑しています。上記の ViewDidLoad コード ブロックにある NSLog ステートメントは表示されますが、表示するビューを取得できません。誰にもアイデアはありますか?よろしくお願いします。