different theme for landscape and portrait mode - iphone

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.

Related

UIButton position depending on device and orientation

I have an UIView in which I load some UIButtons programmatically at certain positions (via plist). The positions are based on the screen size of an 9.7" iPad and landscape orientation.
But naturally the buttons don't stay where they belong when you change the orientation or use it on an 12.9" iPad.
What would be the best solution to handle that issue?
EDIT:
I did it with tow scale factors, one for orientation and one for the device size. I works quite good.

Portrait Orientation is losing touch input

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.

Can you tell which image the iPad has displayed at app launch? (or, I'd like to know the orientation if possible)

There are a number of similar questions on this site about discovering the orientation of the device in applicationDidFinishLaunchingWithOptions being problematic, but I've yet to find a working solution. The problem I have is that I am adding a full screen image (identical to the currently chosen Default-XXX.png being displayed by the OS to my main window. I do this in order to have an animation happen from the 'splash screen' to my first view controller's view.
Works great, except the device keeps telling me that it is portrait mode - meaning I can't match the image being displayed consistently, since I have different graphics for each orientation)
My understanding is that all apps default to portrait orientation until a rotation occurs inside the app (usually when presenting a viewController) but I'm not 100% convinced.
You should be able to solve this using a view controller. When the application has finished launching, present a view controller in the window. Override the shouldAutorotate… query so that the controller autorotates to portrait/landscape and when you receive one of the rotation callbacks, update the image in the view accordingly. The controller will start up in portrait, but if the device is in some other orientation, the rotation callback will immediately follow and you will get the correct image.
P.S. You might find the Orientation Zoo project helpful when debugging this.

How to do orientation rotation like built-in Calc app?

I'm trying to make an app that handles orientation/rotation similarly to the way the built-in Calc app does.
If you check out that app, in portrait mode there's a normal calculator, and if you rotate to landscape mode there are additional buttons that appear to the left.
I can't figure out how to do this by setting the autosize masks. The problem is the "normal" calculator view is 320px wide in portrait mode, but actually shrinks to around 240px in landscape mode to fit the additional controls.
I've seen examples like the AlternateViews sample app that have two different view controllers (one for portrait and one for landscape), but they don't seem to animate the transitions between the views nicely like the Calc app does.
I've also tried setting the frames for the views manually in willAnimateSecondHalfOfRotationFromInterfaceOrientation, but it doesn't seem to look "quite right" and also I'm not certain how that works with the autoresize mask.
Any ideas how this is done? Thanks!
Just override the following method call:
- (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
Inside of there resize all of your components so they look nice.

How to change UIViewControllers like iphone Calculator app does?

in my app when the phone rotates i want to change the view like the Calculator app does, when it is in portrait it shows the normal calc and when it is in landscape it shows the scientific calc. For example in one of my UIViewControllers, for portrait mode, i will have a grid with images and when it is in landscape i want it to show an image and to be able to swap them like in the Photos app. Could you give me any pointer how can i swap the viewControllers on rotate?
thank you in advance, Sorin.
You dont swap view controllers, you swap the view, so create a view for each and then when it rotates push the new view in