objective c - Background color in iOS6.0

Keywords:objective  c 


I am setting the view as a subview in 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

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. In iOS7, the background color changes completely.

1 Answer: 

@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. You can just set the frame of your view with the same size of the window self.view.frame = keyWindow.bounds;