I'm doing an universal ios game and I'm having an orientation problem. My app is all in landscape mode. If I do presentModelViewController is all ok, but if I do setRootViewController, the new controller appear in portrait mode.
What am I doing wrong?
I'm unsure if this was your problem, but I have an application that starts with one view controller in portrait mode and then I'm trying to present a second view controller in landscape mode. I'm using the setRootViewController technique as well so that I do not have to deallocate/reallocate the second view controller and lose my state information since users will be switching between the two views frequently.
I had the same issue where the second view controller would always be displayed in portrait mode instead of landscape, even though the view controller itself specifies that it never allows portrait mode.
The fix for me was to make sure that in the application delegate I presented the first view controller using
[window setRootViewController:controller];
instead of
[window addSubview:controller.view];
This was an older application, and the original template used addSubview by default. it seems that if there was not an original root view controller specified, the necessary orientation messages will never make it to subsequent view controllers that are set as root. Hope that helps!
Have you set the
UIInterfaceOrientation
key in your info.plist file to your desired orientation? (in this case landscape)
Related
I have followed the code here to set the Master/Detail view to show in portrait by adding the following to the Master View Controller.
self.splitViewController?.preferredDisplayMode = .allVisible
Issue I am having is that viewWillAppear is not being called in portrait mode on my iPad, this works just fine in landscape mode. I use this method to fetch data from server.
I know I could hack something into the viewDidLoad and if iPad and Portrait to do this call but I don't think that is the correct way of doing it.
What am I missing here, sorry new to iOS programming.
Okay so I'm new to the whole storyboarding functionality in iOS 5. I have an application for iPad that is locked into landscape mode. Just to test out the seguing functionality, I took my initial view controller, added a button, dragged a new view controller next to it (which shows up in landscape mode visually on the designer), then tied the segue action to the button. I left everything defaulted.
Hitting the button on the initial view controller initiates the segue with no problems, and the new screen loads up, but ALWAYS in portrait mode.
What am I doing wrong? Is there some toggle I'm missing? I figured that if via the summary of the project, I have it locked into landscape left and right, it would assume I always want that orientation unless otherwise noted? Please help!
I had the same problem and managed it by adding a new own ViewControllerClass to the new scene.
Within the following auto created method, you can restrict the orientation to landscape only. This is also helpful for the Main Scene ViewController:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (UIInterfaceOrientationIsLandscape(interfaceOrientation));
}
Cheers,
Daniel
I have an application for iPad that is locked into landscape mode.
How are you locking it app-wide? Just want to make sure you are doing it correctly.
To lock an orientation in Storyboard mode, select your ViewController and on the Attributes inspector change the Orientation from Inferred to whatever you want it to be locked to.
What have you put in the orientation delegate method?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
In the properties file for your app (YOURAPPNAME-Info.plist), located in the "supporting files" group, there is an array called "Supported interface orientations". Remove both landscape values from the array and your app will be locked in portrait orientation.
My app should have a back end for the admin to change some settings, but in the back end view, I want to use a uisplitviewcontroller,
also the app only works in landscape mode,
the problem is that I have read the uisplitviewcontroller is only used in a root view scenario,
the other problem I noticed is that if I make a test app with uisplitviewcontroller (in root view) as in template, but put the app to only work on landscape mode, the right part of the uisplit doesnt show,,
so what to do? to accomplish a splitview kind of settings happening? (in second view)
* uisplitviewcontroller in a second view (how to make the landscape by default work??)
* uisplitviewcontroller faked with a table and loading views on the right side?? (how to do this??)
thanks!!
so, Im still customizing it,
but I ended up using this
APSplitViewController – a custom SplitViewController
thanks to the developer that this this
How does a UISplitViewController know when it has rotated so that it can trigger the appropriate behavior with managing its views? Is there some way I can manually trigger it myself? I have a split view controller owning a view that is not at the root of my hierarchy, so it is not getting the rotation events that (I think) normally allow it to handle rotation behavior.
You can try to implement UISplitViewController delegate which is:
// Landscape mode
– splitViewController:willShowViewController:invalidatingBarButtonItem:
// Portrait mode
– splitViewController:willShowViewController:invalidatingBarButtonItem:
Since the masterView (left) will show/hide accordingly when the rotation occurs, I found this is more effective compared to handling the orientation changes if each view
I guess UiSplitViewController doesn't autorotate and
iPad: SplitView does not rotate pretty much say that unless the controller's view is the root view, it won't work. Oh apple.
You could sign up for notifications of orientation changing, make sure you have shouldAutorotateToInterfaceOrientation set to YES for the rotations you want to support as well.
I'm working on an iPad app that uses a UISplitView. Inspired by http://blog.blackwhale.at/2010/04/your-first-ipad-split-view-application/, I display a button in my detail view when in portrait mode that shows the popover controller. This works great. However, the appropriate UISplitViewControllerDelegate message is only sent when the device rotates. So, when the app first loads (in portrait mode), my navigation button is not visible.
Is it possible to somehow convince the UISplitViewController to send that message on load or something, or do I need to re-implement my own popover logic to get things working?
Thanks,
-Patrick
We had the exact same issue and it turned out that this thread had the right clues. When comparing our app with the SplitView template, we noticed that the split template does exactly what was mentioned here: set the UISplitViewController as the root view controller in application:didFInishLaunchingWithOptions.
Out previous solution linked the split view controller in the XIB directly to the window. While this works it seems the split view has difficulties getting the startup orientation and the missing button occurs. When we removed the link in the XIB and created it in code in the app delegate, everything ran fine.
That's weird. Maybe you missed something. Take a look at the template based on a splitController. It works fine form very startup no matter in what mode the app was loaded.
did you make sure that your UISplitViewController's view is the only subview of your UIWindow, and that you added it inside the application:didFinishLaunchingWithOptions: method of your app delegate