Ios 视图控制器未显示
我正在开发一个包含多个模态视图控制器的棒球游戏应用程序。但是,当我从“BasicGameSetupViewController”到“BasicViewController”进行模式转换时,会发生转换(因为我在BasicViewController中的ViewDidLoad方法中有NSLog语句),但实际视图不会更新。下面是我转换到BasicViewController的方法(此代码位于BasicGameSetupViewController中): (此块还有一个“prepareForSegue”方法) 下面是BasicViewController中的viewDidLoad方法:Ios 视图控制器未显示,ios,xcode,ipad,object,uiviewcontroller,Ios,Xcode,Ipad,Object,Uiviewcontroller,我正在开发一个包含多个模态视图控制器的棒球游戏应用程序。但是,当我从“BasicGameSetupViewController”到“BasicViewController”进行模式转换时,会发生转换(因为我在BasicViewController中的ViewDidLoad方法中有NSLog语句),但实际视图不会更新。下面是我转换到BasicViewController的方法(此代码位于BasicGameSetupViewController中): (此块还有一个“prepareForSegue”
- (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];
}
- (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语句将显示,但我无法让视图显示。有人有什么想法吗?
提前感谢您的帮助 您期望看到什么以及您实际看到的是什么?这不是您想要的答案,但这里有一些建议和建议:您通常应该尽早致电[super viewDidLoad]。否则,超类可能会干扰您自己的实现@MoisesCardenas,我确实在[viewDidLoad]方法的顶部有[super viewDidLoad],但它仍然在做同样的事情…@LuisCien,我希望看到BasicViewController的视图(我在情节提要中创建的),但我看到的是我在情节提要中设计的BasicGameSetupViewController。我原本以为它被锁定了,但我把NSLog语句放在了显示的BasicViewController中,所以它肯定会进入BasicViewController