سؤال

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.

هل كانت مفيدة؟

المحلول

You should use Auto Layout in your nib

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top