[英]running ios4.2 app on on simulator is OK, on devices, a NIB view is blank
I developed an iphone app in xcode 3.2.5. 我用xcode 3.2.5开发了一个iPhone应用程序。 As you know this version of xcode only comes with sdk for 4.2.
如您所知,此版本的xcode仅包含4.2的sdk。 While testing the app, I set the active executable to iPad simulator 3.2., when this executable is run, one of the views in the app in completely blank (white), the UINavigationController nav bar is still visible though.
在测试应用程序时,我将活动的可执行文件设置为iPad模拟器3.2。运行该可执行文件时,应用程序中的视图之一完全空白(白色),但UINavigationController导航栏仍然可见。
This blank view happens to be the only one loaded from a NIB file, the other (working) views are all programmatically generated. 该空白视图恰好是从NIB文件加载的唯一一个,其他(工作)视图都是以编程方式生成的。
I set the IOS deployment target to be ios 3.2 in the build settings. 我在构建设置中将IOS部署目标设置为ios 3.2。
Is there any reason for my problem? 我的问题有什么原因吗? My view is fairly simple, a few buttons, labels and a UIWebView.
我的视图非常简单,有几个按钮,标签和一个UIWebView。
Edit: the view was constructed in IB. 编辑:视图是在IB中构造的。 FWIW there are a handful of images in the view also
FWIW视图中也有少量图像
Update: I've since run the app on devices (iPad 4.2 & iPhone 3.1) with the same problem, this particular view appears all white. 更新:自此我在具有相同问题的设备(iPad 4.2和iPhone 3.1)上运行该应用程序,此特定视图显示为全白色。
In response to comments; 回应评论; In IB I set the File's Owner's class to be my view controller then set the viewcontroller's view to be the root view (in this case a UIScrollView) by connecting the 'dot' to the UIScrollView.
在IB中,我将文件所有者的类设置为我的视图控制器,然后通过将“点”连接到UIScrollView来将视图控制器的视图设置为根视图(在本例中为UIScrollView)。
I don't have an init method for the view controller, below is the viewdidload method. 我没有用于视图控制器的init方法,下面是viewdidload方法。
- (void)viewDidLoad{
[super viewDidLoad];
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:nil];
self.navigationItem.rightBarButtonItem = addButton;
self.navigationItem.title=[programme CAOCode];
[addButton release];
NSMutableString *subTitle=[NSMutableString stringWithString:[programme CAOCode]];
[subTitle appendString:@" "];
[subTitle appendString:[programme AwardType]];
[subTitle appendString:@" in"];
[subtitle setText:subTitle];
[maintitle setText:[programme Title]];
btnCurrentTab=aboutThisProgramme; // this is startup active tab
[details loadHTMLString:[self GetOverViewHTML] baseURL:[NSURL fileURLWithPath: [[NSBundle mainBundle] bundlePath]]];
}
Finally, this is the code which instantiates the problematic controller (from a tableviewcontroller) 最后,这是实例化有问题的控制器的代码(来自tableviewcontroller)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Create and push a detail view controller.
ProgrammeViewController *programmeViewController = [ProgrammeViewController alloc];
Programme *selectedProg = (Programme *)[[self fetchedResultsController] objectAtIndexPath:indexPath];
// Pass the selected course to the new view controller.
programmeViewController.programme = selectedProg;
[self.navigationController pushViewController:programmeViewController animated:YES];
[programmeViewController release];
}
The problem is in the line 问题出在行中
ProgrammeViewController *programmeViewController =
[ProgrammeViewController alloc];
If you are loading it from a NIB file it should be something like 如果您是从NIB文件加载的,则应该类似
ProgrammeViewController *programmeViewController =
[[ProgrammeViewController alloc] initWithNibName:@"MyNibName" bundle:nil];
"MyNibName" should be the file name of the nib without the .xib file extension. “ MyNibName”应该是不带.xib文件扩展名的笔尖的文件名。 Make sure of course that the nib file is included in the build.
当然,请确保生成文件中包含nib文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.