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

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
Is it possible (in IB) to set a different view for landscape mode than for portrait?
 

Enuratique

macrumors 6502
Apr 28, 2008
276
0
Is it possible (in IB) to set a different view for landscape mode than for portrait?

I don't know about in Interface Builder. You can build your two separate views (landscape and portrait) in IB and then programatically switch the two in response to orientation change events.

Don't know if this is what you were looking for.
 

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
Yeah I was thinking about doing it programmatically.. it would just be easier for prototyping purposes to be able to do that..
 

Enuratique

macrumors 6502
Apr 28, 2008
276
0
I dont really understand the question. mind being a little more specific?

I think what he means is having a different view based on the orientation of the iPhone - like the new calculator which switches into scientific mode (more buttons, etc) when in landscape mode. This is easier to do with two separate views than to try and redraw one view with more buttons and what not. He was wondering if there was any way to simulate this in IB (I think).
 

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
I think what he means is having a different view based on the orientation of the iPhone - like the new calculator which switches into scientific mode (more buttons, etc) when in landscape mode. This is easier to do with two separate views than to try and redraw one view with more buttons and what not. He was wondering if there was any way to simulate this in IB (I think).

Exactly what I meant.
 

Enuratique

macrumors 6502
Apr 28, 2008
276
0
Unfortunately, I don't know if this is doable entirely within IB. In my experience, IB is great for laying out the UI and hooking up outlets and delegates, but for anything more advanced, such as this, you gotta rely on code. I'm not saying it can't be done, I just don't know of a way.
 

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
Thats fine with me. I still have a lot of work in design and such, but I'll make sure to "enclose" the tableview and toolbars in a UIView so that when I rotate, I can clear it or redraw into it. Maybe I can even have two separate nibs, which are changed out when it is rotated. Well I have my hands full for now, but that knowledge helps in the design process.
 

gralem

macrumors member
Mar 25, 2002
48
0
There is a little rotating-arrow on the right-side of the window titlebar in Interface Builder. Click on that and you will be working in landscape mode. Is this what you are looking for? Then have 2 views, like "MainView.xib" and "MainViewLandscape.xib". You will switch xibs somewhere in the view controller (like in [willRotateToInterfaceOrientation:duration:] or [didRotateFromInterfaceOrientation:]). There is a section in the UIViewController document on "Handling Rotations".

Hope this helps.

---gralem
 

Attachments

  • Picture 3.jpg
    Picture 3.jpg
    8.9 KB · Views: 1,506

jasonbrennan

macrumors member
Jul 12, 2006
35
0
You will switch xibs somewhere in the view controller (like in [willRotateToInterfaceOrientation:duration:] or [didRotateFromInterfaceOrientation:]). There is a section in the UIViewController document on "Handling Rotations".

Hope this helps.

---gralem

I'm having trouble doing just this. I am not using IB, but I have two UIViewControllers, and I'm trying to get rotation working like how it works in the iPod app.

I have some methods overridden (including the ones you've mentioned) and I can get one view to show after the rotation, but rotating back causes problems.

The main problem is my first (portrait) controller is/has a UINavController, and when I rotate, I don't want a nav controller. I've tried doing something like [self.navigationController.parentViewController setView:myLandscapeView];, but when I go back, I don't know how to restore the old view...it's madness. Any help would be great!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.