开发者

Can a Title bar can be placed in the center of the screen?

开发者 https://www.devze.com 2023-03-31 09:46 出处:网络
I mean There is bar with titl开发者_如何学Pythone in the center and close button in the left side and another button on the right side. Is it possible to place that bar in the center of the screen hor

I mean There is bar with titl开发者_如何学Pythone in the center and close button in the left side and another button on the right side. Is it possible to place that bar in the center of the screen horizontally ?? Like that bar will take care of the screen below it and will not care about the content above it .


There are a couple of approaches you can take (the numbers I am using are just approximate so that you can get an idea):

Create a navbar in the center of the screen

CGRect frame = CGRectMake(0.0, 250.0, 320.0, 40.0);
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:frame];

But this is the preferred way:

Create a navigation controller occupying the bottom half of the screen

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:yourViewController];
navController.view.frame = CGRectMake(0.0, 250.0, 320.0, 230.0);
[self.window addSubview:navController.view];
0

精彩评论

暂无评论...
验证码 换一张
取 消