- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor=[UIColor whiteColor];
ViewController* controller=[[ViewController alloc] init];
UIView* rootView=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[rootView setTag:1];
controller.view=rootView;
self.window.rootViewController=controller;
UIButton* button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame=CGRectMake(120, 100, 80, 40);
[button setTitle:@"确定" forState:UIControlStateNormal];
[button addTarget:self action:@selector(clickHadle:forEvent:) forControlEvents:UIControlEventTouchUpInside];
[rootView addSubview:button];
UILabel* label=[[UILabel alloc] initWithFrame:CGRectMake(60, 40, 180, 30)];
[label setText:@"初始文本"];
[label setTag:11];
[label setBackgroundColor:[UIColor grayColor]];
[rootView addSubview:label];
[self.window makeKeyAndVisible];
return YES;
}
就这么多控件,经测试View能显示,View下面的控件显示不出来,空白一片。我用的Xcode6,以下是我项目配置文件
self.window=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor=[UIColor whiteColor];
ViewController* controller=[[ViewController alloc] init];
UIView* rootView=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[rootView setTag:1];
controller.view=rootView;
self.window.rootViewController=controller;
UIButton* button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame=CGRectMake(120, 100, 80, 40);
[button setTitle:@"确定" forState:UIControlStateNormal];
[button addTarget:self action:@selector(clickHadle:forEvent:) forControlEvents:UIControlEventTouchUpInside];
[rootView addSubview:button];
UILabel* label=[[UILabel alloc] initWithFrame:CGRectMake(60, 40, 180, 30)];
[label setText:@"初始文本"];
[label setTag:11];
[label setBackgroundColor:[UIColor grayColor]];
[rootView addSubview:label];
[self.window makeKeyAndVisible];
return YES;
}
就这么多控件,经测试View能显示,View下面的控件显示不出来,空白一片。我用的Xcode6,以下是我项目配置文件
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货