Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
Hey,

Upon creating a new window in IB, I now notice the little arrow in the top right corner allowing rotation to be simulated. It works great for some of my views, resizing my buttons for me and what not, but on others I need to change the size of a component when it is rotated to landscape (and obviously change it back when it's rotated to portrait).

I can't see any way to create state between the two orientations - changing a component in one orientation changes it in both... is there a way to give it state in IB so it knows which way up it is and how to display a component when it is that way up?

Also, how do I get this nice rotation simulation in an XIB containing only a view (no window)?

Cheers
 

RossOliver

macrumors regular
Original poster
Nov 6, 2006
157
0
I take it that this can't be achieved in Interface Builder yet then? Is it likely to appear in the final release or is it something that will only every be achieved programmatically?
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
Hey,

Upon creating a new window in IB, I now notice the little arrow in the top right corner allowing rotation to be simulated. It works great for some of my views, resizing my buttons for me and what not, but on others I need to change the size of a component when it is rotated to landscape (and obviously change it back when it's rotated to portrait).

I can't see any way to create state between the two orientations - changing a component in one orientation changes it in both... is there a way to give it state in IB so it knows which way up it is and how to display a component when it is that way up?

This is something you'd want to do programmatically. In truth, Interface Builder can only do simple things and whenever you need to do stuff like animation you're going to need to go back to code. This is the reason all the WWDC sessions show the code method needed in order to achieve different things rather than just dragging some objects around in IB. IB can be a useful tool (though I haven't really thought its worth in while for UIKit yet), but you always want to know how to do things programmatically and what the equivalent code would be for each of your actions in IB. It can only help you.

Also, how do I get this nice rotation simulation in an XIB containing only a view (no window)?

Cheers

UIView cannot auto-rotate - you need a UIViewController in order to catch the rotation notifications, which the UIWindow object in IB presumably creates to manage the window's view.
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
we're talking about an iphone window right?
You need to learn how to use the auto resize features in IB. By utilizing those options properly your buttons will behave properly when you rotate the view.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.