我在我的app委托中使用以下代码以编程方式创建应用程序的窗口和根控制器:
element.on("mouseup", (evet: JQueryEventObject) => {
console.log('INFO: caret changed, new value: ', EditorEvents.GetCaretPosition(<HTMLInputElement>element[0]));
代码工作正常,但与根视图控制器关联的视图与状态栏重叠,我想避免(见下图)。
我该怎么办?特别是我希望状态栏具有浅灰色背景(类似于使用故事板创建的应用程序),并且还能正确处理方向更改。
由于
答案 0 :(得分:2)
嗯,你可以做以下事情:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[UIViewController alloc] init];
self.window.rootViewController.view.backgroundColor = [UIColor whiteColor];
UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0,
[UIApplication sharedApplication].statusBarFrame.size.height,
[UIScreen mainScreen].bounds.size.width,
[UIScreen mainScreen].bounds.size.height)];
redView.backgroundColor = [UIColor redColor];
[self.window.rootViewController.view addSubview:redView];
[self.window makeKeyAndVisible];
return TRUE;
}
应如下所示: