我正试图在iPhone教程中找到进入Obj( 这 )的途径。不幸的是,代码中肯定缺少一些东西,因为SubViewOneController的视图没有出现。
有人在评论中提出了解决这个问题的办法:
没有出现
SubViewOneController’s视图的解决方案是,您需要告诉控制器该视图将从一个nib文件中初始化。进入SubViewOneController.m并取消注释以:开头的代码
不幸的是,代码中没有这样的表达式。他所指的一定是xCode自动生成的代码片段,我已经没有雪崩了。你能告诉我现在到底要改什么吗?
发布于 2009-09-03 13:07:18
尝试将其复制到SubViewOneController.m中。
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:@"SubViewOne" bundle:nil]) {
// Custom initialization
}
return self;
}发布于 2009-09-03 21:07:12
我不知道我是否会覆盖initWithNibName。当您需要这个视图时,为什么不直接调用initWithNibName呢?例如,在下面的代码中,我将获得一个新的视图
-(void) GetHighScoresView
{
if (highScoresTableViewController == nil) {
HighScoresViewController *aView = [[HighScoresViewController alloc] initWithNibName:@"HighScoresView" bundle:[NSBundle mainBundle]];
self.highScoresViewController = aView;
[aView release];
}
}https://stackoverflow.com/questions/1373274
复制相似问题