ipad上的iOS黑色屏幕,而不是iphone
我有一个问题,我坚持了几个小时。ipad上的iOS黑色屏幕,而不是iphone
我有一个iPhone,它成功地使它到了App Store。现在我希望它支持iPad。
为了实现这一目标,我创建新的XIB-文件为iPad的名称他们是这样的:
iPhone:RootViewController_iPhone.xib
的iPad:RootViewController_iPad.xib
然后我设置文件的所有者适当地。
这是我给他们打电话:
MyViewController *vC;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
vC = [[[MyViewController alloc] initWithNibName:@"MyViewController_iPhone" bundle:[NSBundle mainBundle]] autorelease];
} else {
vC = [[[MyViewController alloc] initWithNibName:@"MyViewController_iPad" bundle:[NSBundle mainBundle]] autorelease];
}
在每个视图 - 控制我然后做出具体取决于当前器件系列的一些自定义layoutfixes。
这对我所有的意见都适用,豁免他们两个。 无论我尝试过什么,屏幕都保持黑色。 我查了this,this或this,只列出了几个问题。显然我无法解决这个问题。
任何想法,为什么这只发生(幸运)我的两个意见?
在此先感谢。
编辑: 下面是一些初始化代码:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
NSLog(@"frame: %@", NSStringFromCGRect(self.view.frame)); //frame: {{0, 0}, {768, 1004}}
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; //no result here
}
return self;
}
- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
UILabel *l1 = [[UILabel alloc] initWithFrame:CGRectMake(50, 50, 100, 30)];
l1.backgroundColor = [UIColor clearColor];
l1.text = @"Zurück";
l1.textColor = [UIColor blackColor];
l1.textAlignment = UITextAlignmentCenter;
l1.font = [UIFont fontWithName:@"Helvetica" size:10];
[self.view addSubview:l1];
[l1 release];
}
我建议这样做(不会离开束无)
initWithNibName:@"RooViewController_iPad" bundle:[NSBundle mainBundle]] autorelease];
Altough,我不知道这是否会帮助...
谢谢,这是安静的明显。不幸的是,这并没有改变任何东西 – pmk 2012-03-15 14:54:46
我认为它可能不会帮助你,但我试过:)) – 2012-03-15 14:59:18
我相信你的问题在于自己的意见...你可以给他们更多的信息.. – Shubhank 2012-03-15 14:49:36
有你检查了nib文件中的所有链接? mainView是否正确连接到'view'属性? fileOwner是否已设置?你在'viewDidLoad'中做了什么额外的initalising? – calimarkus 2012-03-15 14:52:20
我发布了一些初始化代码。我一遍又一遍地比较了nib文件,我无法发现与其他nixs有什么不同 – pmk 2012-03-15 15:08:57