[英]UINavigationController: viewDidLoad is called but doesn't affect the UI
I have this in the App Delegate 我在App Delegate中有这个
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
OneViewController *vc = [[OneViewController alloc] initWithNibName:@"OneViewController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
[self.window setRootViewController:nav];
[self.window makeKeyAndVisible];
return YES;
}
and this in OneViewController 这在OneViewController中
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
[button setTitle:@"Hi" forState:UIControlStateNormal];
[self.view addSubview:button];
}
But when I run the app in the simulator, the OneViewController screen is blank. 但是当我在模拟器中运行应用程序时,OneViewController屏幕是空白的。 It has a xib file which is just the default blank xib.
它有一个xib文件,它只是默认的空白xib。
在iOS 7中,按钮的背景颜色和标题的字体颜色都是白色的。您可以将按钮的背景颜色或按钮的标题颜色设置为黑色以使按钮显示吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.