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