简体   繁体   English

iOS6.0中的背景颜色

[英]Background color in iOS6.0

I am setting the view as a subview in UIWindow. 我将视图设置为UIWindow中的子视图。 It's working fine as such. 它的工作正常。 I am able to load the view and do my work; 我能够加载视图并完成我的工作; however, if I actually go and change the background color, in a small area at the bottom the color doesn't change. 但是,如果我真的去改变背景颜色,在底部的一个小区域内颜色不会改变。

This is the code that I am using to add this view as a subview to Window 这是我用来将此视图作为子视图添加到Window的代码

UIWindow* keyWindow= [[UIApplication sharedApplication] keyWindow];
[keyWindow addSubview: self.view];

This is the code to change the color: 这是改变颜色的代码:

self.view.backgroundcolor =[UIColor bluecolor];

This behaviour happens only in iOS6. 此行为仅在iOS6中发生。 In iOS7, the background color changes completely. 在iOS7中,背景颜色完全改变。

@Fogmeister is correct you should add a rootViewController to it, but just replying your question, your view has not the same size of the window, so this small area at the botton is the uiwindow you are seeing behind your view. @Fogmeister是正确的,你应该添加一个rootViewController,但只是回答你的问题,你的视图与窗口大小不同,所以在botton的这个小区域是你在视图后面看到的uiwindow。 You can just set the frame of your view with the same size of the window self.view.frame = keyWindow.bounds; 您可以使用与窗口相同的大小设置视图的框架self.view.frame = keyWindow.bounds;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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