繁体   English   中英

当前视图控制器显示黑屏

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM