In my iPad app, i am supporting only portrait mode except on one screen. I have tab bar at bottom, on click of any tab,it opens a small view of size 320.0 * 600.0, with table view. On selecting any row in small view, a full screen view opens up. Problem is that when i came on full screen view which supports all orientations, next time,my other view especially the small view comes up with frame size of 768 * 1024.
Any sugeestions or help is appreciated!
I'm guessing the problem is that you read the frame size while still being in landscape mode. If you are running things in the simulator, it probably jumps back to portrait when you dismiss the full screen? This forces the app back to "portait" mode without triggering the normal "willRotate" functionality, and could possibly mess up your code for keeping track of orientations.
Also keep in mind that most apps needs to support all orientations on the iPad to get accepted, unless you're making e.g. a game which is normally specifically designed for either landscape or portrait.
Related
Hello stackoverflow community,
I have just added the constraints to my iPad app and would now like that if you hold the iPad across that you can scroll the page, because not everything fits on a transverse page. If the Ipad is upright you should not be able to scroll (there everything fits).
How can I make that happen?
Edit:
I would like to be able to use landscape mode on my app, which I originally designed to be portrait only. For this I have already inserted all constraints so that the size etc. fits. Now, however, the page is so full that it no longer fits on the complete display in landscape mode. Now I would like to be able to scroll down and thus the complete page is on the display. How it looks at the moment in portrait and landscape format I have loaded into the attachment (do not wonder the app is in German).
Landscape
Portrait
add your views into UIScrollView and set its contentsize, you can thencontrol what should be visible or scrollable for both portrait and landscape
I have an iPad app that is written for Portrait mode; I am trying to add Landscape mode to it using Auto Layout. Everything appears to work just by changing the Size Classes in XCode, except some of the pages are longer when displayed in Landscape mode. My thoughts are to just add a UIScrollView to each page that needs it, at the top of the view hierarchy.
Is this the preferred method of solving this issue?
Yes, when designing an app for both landscape and portrait orientations you usually will need to make the content scrollable in landscape orientation.
You can also create a different layout for the landscape orientation and completely re-layout the UI components when the app rotates, but for simplicity putting all of your objects in a scroll view will solve your issue of limited real estate on the screen.
The app I'm developing uses a UINavigationController to control a variety of UIViewControllers, some of which are displayed in portrait orientation, and some of which are displayed landscape. Once one of the landscape ones is displayed, if I navigate back through the pages to the root view, part of the keyboard is still displayed landscape:
...instead of how it should be (and originally is) displayed:
I've paused the debugger (attached to the iPod) when the root view is loaded after displaying the landscape view, and in lldb, run po [UIDevice currentDevice].orientation. It outputs 1, which is the value for UIDeviceOrientationPortrait. So although the device knows it's in portrait mode, part of the keyboard is landscape. I've never seen anything like this before, and am not sure what else to check.
I have an app that is a single view: a UIWebView that gets pdfs loaded into it. The pdfs are loaded from an ECSlidingViewController.
For some reason, when the app goes from portrait to landscape, the WebView remains in the same position and there is a large dark area to the left of the screen.
Portrait:
Landscape:
I have tried a number of techniques, but they each have problems. For example I can't simply reload a landscape view when the orientation changes, the user will lose their place in the webview. Any ideas?
I have the following code in the viewWillAppear function:
CAGradientLayer *bgLayer = [BackgroundLayer yellowGradient];
[bgLayer setBounds:self.view.bounds];
[self.view.layer insertSublayer:bgLayer atIndex:0];
It works perfectly in portrait orientation. However, when the device goes into landscape mode, it produces a white (or default color) background down the side. I have seen other examples of WHY this occurs, but nothing on how to fix it.
What I’m seeing happening is the 1024 resolution on landscape (iPad) dropping to 1004, and I think it’s adjusting it to 0,20 on the x, y.
Has anyone else run into this issue and found how to fix it?
It’s because when you turn the screen sideways, your view, which has a certain background color, does not turn sideways. The view remains in portrait. So you have this portrait-oriented colored view that’s going from the new “top” of the iPad to way below off screen, and on the right side, the view isn’t wide enough to reach, so you just see the app’s default (white) background color.
You can:
apply a CGAffineTransformMakeRotation rotation to your self.view 90º, so that it now displays properly in your now-landscape application,
make your view big enough to cover the entire device, in both landscape and portrait,
make a view with the proper landscape dimensions, and add it when the iPad rotates, or
disable those allowed interface orientations in your Xcode main project file.
Link to CGAffineTransformRotation Demo Code on SO: How to use CGAffineTransformMakeRotation?