Below is my code from the application delegate in the didFinishLaunchingWithOptions file
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
CGRect windowFrame = self.window.frame;
UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, windowFrame.size.height-100, windowFrame.size.height, windowFrame.size.height)];
bottomView.backgroundColor = [UIColor redColor];
[self.window addSubview:bottomView];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
My ViewController is FreeForm, and its height is about 245. As you can see, I'm trying to set the bottom view with a height of 100 points.
I'm just trying to learn it.
But the view always fills the entire screen. If I comment on setting the view controller as a Windows rootviewcontroller, I can see it at the bottom of the screen.
What am I doing wrong? Please advice.
Thank.
source
share