I have a custom tab bar controller with 4 tabs which manages 4 view controllers, and I support rotation of the device. When I tap one of the tab items and the corresponding view controller and associated view are loaded and shown, changes in the layout by rotating the device are ok. However if, for example, I'm showing a view with the device in portrait orientation, then I tap another tab item and its corresponding view is shown, I rotate this view to landscape, and then, still being in landscape, I go again to the first view by taping its tab item, then such view, that was in portrait when it disappeared, is now in landscape with the portrait sizes and appearance (right-half of the screen is empty and views go out in height)...
What is the way to update the layouts in such situations?
Related
I have a root view which contains a scroll view which contains a (content) view. The content view contains many child controls. Using the simulator, when I change orientation, none of the views, including the scroll view changes orientation. For example the image below starts out in portrait mode and all controls are played out correctly, but moving to landscape mode just shows portrait mode horizontally:
All of this was laid out using Interface Builder, so I don't have much code in the control view file besides some IB outlets to the controls.
Is there some sort of constraint that is preventing the reorientation of all the controls and views? Or do I always have to lay these out manually on orientation change?
First you need to check you have allowed the app to rotate by checking the orientations you want are ticked:
Click on the top-left corner (Show the Project Navigator)
Select the name of your project
See what is under General->Deployment Info->Device Orientation.
Adjust the tickboxes accordingly.
Update:
Also slide up on the simulator and check that rotation isn't locked for the device.
Try putting this in your AppDelegate/view controller:
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
(I don't think it's a constraint/layout issue as the status bar isn't even rotating)
I am using master detail layout in my application. Every thing works fine, but when i clicked on the menu the popover comes and it is placed above the detail view. like this
actually in the detail view i have some videos displayed, like this..
when the popover come the videos are not visible, how to resize the detail view so that it moves right automatically when popover comes and the details are displayed like in case of landscape mode. Thank you..
This is how a UISplitViewController works when in portrait orientation. The detail view can't be resized.
However, just before the popover slides into view, the splitViewController:popoverController:willPresentViewController: delete method will be called. You could implement this and adjust the views in your detail controller to shift as needed. But this would not be standard behavior.
I have a tabbarcontroller with 3 tabs that are splitviewcontrollers.
It works fine except when:
in portrait view tap the rootview button to show the master
popover.
switch to any other tab
rotate to landscape (the masterview controller of that tab appears)
switch back to first tab and the detail view controller is in the
right position (320 px from left border) but instead the master view
I have a black screen
I enumerated the splitviewcontroller subviews but the masterview is not there.
If I rotate the device in portrait and back in landscape, the master view appears.
I try to better explain with this picture:
It seems to me that the problem might be caused by all of your UISplitViewControllers using the same delegate, probably your AppDelegate. That might cause the behavior you're seeing, since when one UISplitViewController returns false from collapseSecondaryViewController:ontoPrimaryController, they all will return false, giving you the padding on the left to make space for the masterViewController. But your UISplitViewControllers which are not active aren't showing the masterViewController, so you get a blank space, instead of what you expect.
NEW EDIT:
I have narrowed my problem to this - i have a view that i add to my main view. That view is nib file in portrait orientation. That view can be added both in landscape or portrait mode. After adding it as subview how do i tell it, device is now in landscape mode, you should autoresize to fit?
OLD:
/*
I have a view, that is loaded via [NSBundle mainBundle] loadNibNamed. When button show is pressed view should show, and likewise when button hide is pressed view should hide. And this works ok.
Problem is with when device orientation is changed (lets say from portrait to landscape mode). If view is shown it resizes ok, and everything works fine. But if view is hidden, and i rotate the device and press show, view is shown, but not adjusted to new layout. It retains its original dimensions.
It is as automatic resizing is only applied to visible components. Is there some way to force resizing of the view?
*/
When you add your view, use the following:
[subViewFromNib setBounds:[viewYouAddedSubviewTo bounds]];
I have an iPad Split View Application that brings up a modal view to display certain content. When I bring up the modal (in PageSheet style) and then change from Portrait to Landscape (or vice-versa) and then dismiss the modal the orientation of the detailViewController (the parent of the modal) turns 90 degrees.
So if I am in landscape mode when I close the modal the right pane will turn as if it were in portrait mode but the device is still in Landscape and the rootViewController is still visible. After this happens no rotation will solve the problem until the view is removed.
Any idea what I've screwed up here? I've had a ton of trouble with iPad rotation handling in general but this one is really giving me problems.
If you are presenting the modal view from either of the two sub-views of the SplitViewController, then you will have the orientation problems. Just present the modal view from the SplitViewController.