Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-25-2010, 08:52 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 65
joec is on a distinguished road
Default One UIViewController or Two for portrait / landscape views

Hi

I am looking for some clarification with regards to view controllers and views. Should one view controller be used exclusively to control one view?

Basically, my portrait view is going to be a 4x3 grid of buttons (within a scrollview). When i rotate the view to landscape, i am going to want maybe a 6x4 grid.

Obviously the functionality for handling the buttons' clicks etc will be the same in either orientation, so it would seem a lot of effort to duplicate this for landscape.

How should i get the view controller to use the correct view xib?

Should i have two seperate xibs? I have tried every combination of autoresize masks and not having much luck.

I'm not sure of the correct way to go.

Thanks.
Joe
joec is offline   Reply With Quote
Old 08-25-2010, 10:40 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

You dont need two xibs IMO. You can implement your custom logic in the shouldAutoRotate method for that viewcontroller to change your grid size from portrait to landscape.
smithdale87 is offline   Reply With Quote
Old 08-25-2010, 10:42 AM   #3 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 65
joec is on a distinguished road
Default

And its ok (accepted practise) to put the logic there? I'm not sure where else it would go?

Thanks
joec is offline   Reply With Quote
Old 08-25-2010, 10:46 AM   #4 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

I've never had need to do any complex view changing when rotating between portrait/landscape, but I think it's fairly common to do it this way.
smithdale87 is offline   Reply With Quote
Reply

Bookmarks

Tags
interfaceorientation, uiview, uiviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 345
7 members and 338 guests
dre, freewind, hain, HemiMG, lendo, Newbie123, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:59 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0