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.

Était-ce utile?

La solution

You should use Auto Layout in your nib

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top