Question

I have a toolbar, which I cannot to locate on the bottom of the screen…

toolbar = [[UIToolbar alloc] init];

[toolbar sizeToFit];

CGFloat toolbarHeight = [toolbar frame].size.height;
CGRect rootViewBounds = self.view.bounds;
CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds);
CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds);
CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight,rootViewWidth, toolbarHeight);

[toolbar setFrame:rectArea];

    [toolbar sizeToFit];

[self.view addSubview:toolbar];

…app is starts, everything is ok, but when I turn the iPad and changing the orientation of the device to portrait, my toolbar is stays higher, not on the bottom of the view.

Was it helpful?

Solution

You should use Auto Layout in your nib

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top