IOS reorganize graphics on rotation - objective-c

I'm making an iPad application with 19 buttons which are alle graphics. They are aligned next to and underneath eatchother, like in a grid. In portrait mode they are displayed nicely (because that's how I've set them) but I don't know what settings I need to choose for landscape mode.
When the device turns to landscape I've got room for 4 columns in stead of 3 in portrait for instance.
How can I make the app automatically adjust they layout of the buttons when rotated?
Thanks

In iOS5.1 or older, you will need to do this in code. In iOS6, its possible you can use a UICollectionView - not sure haven't played with it.

Related

How to have different set of components (views) in portrait and landscape view in iOS

I am trying to create a calculator similar to the iOS 7 calculator as exercise. In course of that I am working on handling the rotation of the app. I went through the articles present over web and they guide to preserve/define the layout for different rotations using the constraints and this is working fine.
But what I am not able to understand is how can I have different set (additional set) of views(buttons) for landscape and portrait rotations. For example, the iOS calculator gets additional buttons in the landscape mode to turn into scientific calculator.

iPhone 5 retina 4 inch touch screen

I'm adapting my app to iphone 5 and I've got a problem. I saw all documentation regarding this and it didn't work yet.
I put the Default-568h#2x.png and everything resized successfully.
The problem is in the touch stuff. I've got a toolbar on the bottom and when I touch it nothing happens :( in the retina 4" simulator. Works fine in retina 3.5
In retina 4", if I set the toolbar in the inspector above 439 px in the Y position works fine. Anything below this makes my toolbar not to work.
As I said, I tried many many things unsuccessfully.
I'm using Xcode 4.6.1, I've got a Main View (not having a Window option in the Attributes inspector).
Thanks in advance.
Your window or the main view is not resizing correctly. Make sure you have set them up such that they autoresize in both directions. Try to set different background colors to your views to find the view that is not resizing correctly.
Ensure that all of your views are auto-resizing correctly to fill the screen. It sounds like the main container view you have isn't being resized and is drawing the toolbar outside of its frame. This will work from a visual point of view as UIView - clipsToBounds defaults to NO, but touches won't work outside the frame.

How to position static buttons and iPhone 5

I am working on an app where i have 12 buttons and labels underneath on one of the views. They are placed on the storyboard directly. I want to make sure they will get properly repositioned in iPhone 5. The solution that i tried is just to deselect all the lines in the autosizing for all the buttons. Now when i try it on iphone 5 the buttons get resized. The problem if i stretch the storyboard and move the buttons they get messed up when running on the smaller screen. So i can only position them on the smaller screen and then it seems to work. The app does not rotate. I would like to know if this is a good solution or there is a better solution for this case. I would like for the app to support iOS 5+
Thank you!
If you want layouts to work with varying screen sizes, you should become familiar with the new constraint-based layout scheme in iOS 6. A WWDC video on the subject can be viewed at http://www.youtube.com/watch?v=Dkr9eKxlMAk&feature=player_detailpage.
Essentially, you're going to use the old struts and springs system for pre-iOS 5 and conditionally use the new scheme for iOS 6. (iPhone 5 won't run any iOS version prior to 6.)

iOS App Portrait and Landscape Views

I'm trying to make and iOS app with both portrait and landscape views, but if I open it and change the orientation to Landscape, some buttons got offscreen, after going to IB and reordering the buttons, in Portrait they go off screen.
After googling, I dont have ANY ideia how to 'change' views according to orientation.
Could you guys give me some help?
Ah, also, Apple Support Documents seems pretty useless to me :P
Thanks!
There a method - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{}
which is useful in such cases.
You should change autosizing properties in IB (they're in the same place where frame size is) or change autoresizingMask properties of your inner views and controls programmatically. This controls what happens to the elements of your screen after it gets resized (for example when the screen is rotating). You can glue your components to left or right or both, top or bottom or both and similar. Play with it, it's pretty powerful and you don't need any code for that if what they can do is enough.

how to change mainwindow.xib's orientation to landscape? [duplicate]

I appreciate I'm probably missing something basic here, but...
My iPad app will only support landscape mode, and has a MainWindow.xib Window that I'd like to work on in landscape mode in XCode 4, however the pull-down menu to change this (Simulated Metrics -> Orientation) is always grayed out.
I notice that Views can be rotated just fine, it's only Windows that can't be rotated in XCode 4 using this setting.
Is there a workaround for this, or do I have to put a View on top of the MainWindow in order to rotate it?
I think it's because apps always starts up in portrait and then rotates to appropriate oriantations. From the UIViewController docs:
Note: At launch time, applications should always set up their
interface in a portrait orientation. After the
application:didFinishLaunchingWithOptions: method returns, the
application uses the view controller rotation mechanism described
above to rotate the views to the appropriate orientation prior to
showing the window.
So you'll need the UIViewController magic for the simulated metrics to make any sense. If you used the "Window-based application" template as a starting point for your project try the "View-based application" template instead.