Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set programmatically topBar and bottomBar parameters of UIView?

In the interface builder there are few parameters for UIView of UIViewController: topBar, bottomBar, ...

enter image description here interface builder parameters of view

What happens when i set Navigation Bar value for Top Bar parameter, and Tab bar for Bottom Bar parameter? It is very useful to me.

So, how can i do it programmatically?

like image 395
BergP Avatar asked Sep 14 '12 08:09

BergP


1 Answers

Actually this parameters are using for building correct interface and even if you will set this bars in Xcode Interface Builder, they will not appear, if you are not using you UIViewController inside some UIViewController containers.

As example if you will add your UIVIewController into UINavigationController, then you will see Navigation Bar as top Bar. This Simulated metrics have no effect in the program, but they will help you to build correct interface, if you expect to use UIViewController inside container.

But if you want to add this Parts of interface programmatically inside your UIViewController, you can use according subiews. As example:

UINavigationBar *yourBar = [[UINavigationBar alloc] init];
[self.view addSubview:yourBar];
like image 189
Gloomcore Avatar answered Oct 02 '22 12:10

Gloomcore