Programmatic View Offset by Status Bar?
I am just looking at setting a up a custom UIViewController programatically (see code below) and I am just curious about the white line I am getting at the bottom of the display, I don't see this when I create the view using a NIB in InterfaceBuilder. Is it just a case of offsetting the frame down by the height of the status bar or am I missing something else?
EDIT:
Found it:
viewController.view.frame = CGRectMake(0.0,20.0,320.0,460.0);
CODE
- (BOOL)application:(UIApplication *)application didFinishLaunchingWit开发者_JAVA百科hOptions:(NSDictionary *)launchOptions {
MyController *tempController = [[MyController alloc] init];
[self setMyController:tempController];
[window addSubview:[myController view]];
[window makeKeyAndVisible];
return YES;
}
SCREEN
Much appreciated ...
Gary
You could try setting up the frame of your controller's view to see what happens:
tempController.view.frame = CGRectMake(0, 0, 320, 480);
By the way, you have a probable memory leak in your method (that should be catched by clang if you enable it).
i guess this problem is related to bounds or Applicationframe. set everywhere bounds -'[[UIScreen mainScreen]bounds];' let's see ...
精彩评论