简体   繁体   English

在模拟器上运行ios4.2应用程序正常,在设备上,NIB视图为空白

[英]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.

相关问题 应用程序在iOS4.2上运行,但不在iOS5上运行 - Application running on iOS4.2 but not on iOS5 下载xcode 4 - 我能坚持使用iOS4.2模拟器吗? - Downloading xcode 4 - will i be able to stick with iOS4.2 simulator? 为运行IOS4.2的iPad关联文件类型时出现问题 - Problem associating file types for iPad running IOS4.2 在ios4.2中解锁iPhone时,推送通知警报应用程序无法打开 - Push Notification Alert comes app not openning when unlocking an iPhone in ios4.2 MKMapView userLocation在iOS5上错误,但在iOS4.2上正确 - MKMapView userLocation wrong on iOS5 but correct on iOS4.2 iOS部署目标设置为iOS 4.2。该应用程序是否会在运行早期版本iOS的设备上运行? - iOS deployment target set to iOS 4.2. Will the app run on devices running earlier versions of iOS? 模拟器中导航栏顶部的空白视图? - blank view on top of Nav Bar in ios Simulator? 多视图应用程序在模拟器中显示空白屏幕 - Multiple View App shows Blank Screen in Simulator 仅使用iOS 5设备和iOS 4模拟器测试应用程序可以吗? - Is testing an app with only an iOS 5 device and iOS 4 simulator OK? iOS如何在用户选择其他主题时刷新正在运行的应用程序(即,强制视图控制器重新加载不同的Nib文件) - IOS How to refresh a running app when user selects a different theme (i.e. force view controllers to reload with different nib files)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM