我正在开发一款包含多个模态视图控制器的棒球游戏应用。但是,当我从“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语句显示,但我无法显示视图。有没有人有任何想法? 提前感谢您的帮助!