在视图中使用rootViewController后,窗口触摸屏访问nib

时间:2015-12-01 19:37:27

标签: ios objective-c ios8

美好的一天。

我无法弄清楚如何在将rootViewController提供给一个,然后执行以下操作后,将触摸屏访问到nib,然后执行以下操作,以显示nib:

在LaunchViewController:

_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[[NSBundle mainBundle] loadNibNamed:@"PhoneContent" owner:self options:nil];
[self.window makeKeyAndVisible];

//if omitted, screen shows LaunchViewController only
[self.view removeFromSuperview];

" PhoneContent"上课有:

- (void)awakeFromNib{
// load our data from a plist file inside our app bundle
NSString *path = [[NSBundle mainBundle] pathForResource:@"content_iPhone" ofType:@"plist"];
self.contentList = [NSArray arrayWithContentsOfFile:path];
self.rootViewController.contentList = self.contentList;

AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.window.rootViewController = (UIViewController *)self.rootViewController;
}

其他信息:

PhoneContent是一个持有Nib(.xib)的NSObject

显示的笔尖是可视化的,但不会对触摸手势做出反应。

0 个答案:

没有答案