UIView frame size issue

I am working on an iPad project, it is currently in landscape view. And I tried to do:

self.view.frame.size.height 

Why is it always coming back 960? Although, as in the landscape, the size of the height of the view itself should be equal to 768?

What I'm trying to do is allocInitWithFrame a UIToolbar , which is located at the bottom. UIToolBar has a height of 50, so here is what I did, which failed:

 self.bottom_bar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.frame.size.height-50, self.view.frame.size.width, 50)]; 

Why is this and how to do it?

+7
source share
1 answer

Two posts ( one and two ) referred to a similar problem. Both of them suggest using self.view.bounds instead of self.view.frame.size.width because borders change along with the orientation of the interface.

+6
source

All Articles