I'm making a universal apps with auto rotation, and I'm only using landscape left and right. When I rotate the iPhone to the portrait down position, I can see what looks like a window underneath the app rotating and I no longer get touch events.
In all the shouldAutoRotate functions I'm making sure only return true for landscape, and the info.plist only allows landscape left and right.
Sounds like your view is not correctly resizing after an orientation change. Easy way to check this is to set the background color to something non-white.
Related
I have two stacked UICollectionViewCell's in my app in both portrait and landscape modes. However when in landscape mode I would like the cells to switch to side by side and rotate any of their contents appropriately as well. How do I do this? I am using xcode 8 and swift.
If I understood you correctly, you will need to detect orientation changes on the screen and when you detect landscape or portrait, change the Scroll Direction property to the one that you want either vertical or horizontal.
You cannot subclass UIImagePickerController, but surely there is clean(not saying obvious or easy) way to keep camera feed as background of UIViewController and just make UIImagePickerController overlay to rotate like it would respond to shouldAutorotateToInterfaceOrientation: ?
I just want to UIImagePicker stay in its beloved portrait orientation, but I want rotate my UI buttons that I put into camera overlay. What I have now, is changing each element's orientation with CGAffineTransformMakeRotation() so it always stays at the same place, but rotates around each center.
I downloaded Layar app and the somehow achieved it... camera feed stays and UI buttons rotates (like UIViewController's style).
edit: I have to use iOS 5.1 and Xcode 4.2
edit2: for now I have this int DIRECTION and depending on what is the current orientation of the device I assign from 0 to 3, so I can decide with what angle to rotate all UI buttons. I do this inside shouldAutorotateToInterfaceOrientation: which is returning only YES for portrait and upside portrait.
You have to put constraints on the buttons and picker view.
Use this link to study AutoLayout concept by Ray Wenderlich
Hope this will help but you have to go through it thoroughly.
I've been working on this for days and can't crack it. The sequence of events is:
In landscape (let's just say right), the user hits an "edit" button.
A portrait only modal interface slides in. Its shouldAutorotateToInterfaceOrientation returns yes only for portrait.
The device becomes convinced it is in portrait mode.
Problem 1: If the user dismisses the interface without having actually rotated to portrait mode, the device reports that is in landscape right orientation (which it is), but the interface is laid out in portrait orientation.
Problem 2: If the user rotates to portrait, the interface does not get laid out again.
Problem 3: (And this one is weird) Rotating back to the same landscape orientation (right) where the edit button was pressed causes the status bar to return to landscape, but nothing else changes. All my stuff remains laid out in portrait mode. Rotating to the other (left) landscape orientation works perfect.
I need some way to force the layout engine to redo the layout for the orientation the device is actually in.
UIView - layoutSubviews, - setNeedsLayout, and -layoutIfNeeded don't have any effect.
Thanks for any help.
Do what iBooks (2.x) does and force the interface orientation to portrait with
+ (void)attemptRotationToDeviceOrientation. This way, you nip the problem in the bud at step one.
Let me explain what I am creating and it will be nice if someone could tell me a better approach.
I am creating an app that supports all orientations. The app is like a power point presentation with several slides with several images and basic functionality in each slide. the functionality is very simple such as showing an image or moving an image when a button is pressed for example. So creating the app is not the problem. Since this app has to support all orientations when the device enters portrait mode I need to move the content in order to make it fit for the portrait orientation. And I would have to do the same thing if it enters landscape mode. Because there is so much content in every slide I need to change the content very much when changing orientation. so an image in portrait mode might have cords (20,5) and on landscape mode that image will have totally different coordinates.
So is there a way that I can set the IBOutlets have specific cords on landscape and specific cords on portrait with xcode. It takes me forever to store the cords of every IBOutlet in an array since I have so many IBOutles in each slide. I have to store the CGPoints in an array with the cords of IBOutlets in landscape and portrait mode and then if the device enters landsape mode set it's center equal to the array elemets. THIS IS SIMPLE BUT IT TAKES FOREVER!
Moreover I am creating many xib files and treat each xib as a different slide in my app.
With what you are saying, you need two xibs for each "slide". One that describes the portrait orientation, and one that describes the landscape orientation.
I would like to change orientation of lower half of my view similar to stock app in which when we change the orientation of device only the Graph view of the same rotates. Please let me know how I would achieve the same functionality.
You can apply a CAAffineTransform to any view independently causing it to rotate to any arbitrary degree regardless of the device orientation.
However, system views such a the keyboard appear rotated with the device and not the view i.e. if you rotate a text field, the keyboard will appear in the device orientation not the text fields transformed orientation.