![](/img/trans.png)
[英]Presenting new view controller from alert view handler displays black screen
[英]Present view controller displays black screen
我正在尝试使用Objective C中的代码来呈现视图,但是它附带的只是标题栏和黑屏。 这是我正在使用的代码:
MoreByUserViewController *morebyuser = [[MoreByUserViewController alloc] initWithOwnerId:self.ImageOwner];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:morebyuser];
[self presentModalViewController:navController animated:YES];
我从启动视图(这里称为“视图1”)调用此视图,而我要加载的视图将是“视图2”。
我没有将View 2作为#include或@class包含在View 1中,我需要吗?
就像Ryan和Dustin所说的那样,您可能没有在initWithOwnerID
方法中加载笔尖。 我建议先初始化视图,然后再将ownerID
设置为属性。
MoreByUserViewController *morebyuser = [[MoreByUserViewController alloc] initWithNibName:@"MoreByUserViewController" bundle:nil];
[morebyuser setOwnerID:self.ImageOwner];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:morebyuser];
[morebyuser release];
[self presentModalViewController:navController animated:YES];
[navController release];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.