0

i am very new to xcode. i have an app which supports both for iphone and ipad.presently my app supports portrait orientation, now i want to support it for landscape also.

As i goggled it and got an idea that we have to maintain two views for that.is this is the only way to do that? can't i maintain with singleview for landscape and portrait ?

if this is only the way provide me a good tutorial to do this because i have lots of views.

Note: my app should support in ios 4,5,6 also

thankyou

Stefan
  • 5,203
  • 8
  • 27
  • 51
siva
  • 251
  • 2
  • 16

1 Answers1

1

The answer is NO . You need not use 2 Xib's. Please go through the following links :-

Easiest way to support multiple orientations? How do I load a custom NIB when the application is in Landscape?

Different Xib's for Potrait and Landscape mode for iPad

http://www.theappcodeblog.com/2011/03/30/orientation-change-tutorial-change-the-view-when-the-orientation-changes/

Also ios 6 offers new methods like shouldAutoRotate etc. You might want to go through them too.

Community
  • 1
  • 1
IronManGill
  • 7,222
  • 2
  • 31
  • 52
  • so i need to use two views for each nib file – siva Jul 03 '13 at 11:02
  • sry i am not asking you about iphone and ipad i am asking you for different orienattions – siva Jul 03 '13 at 11:17
  • is it possible with out 2 xibs or with out 2 views ? – siva Jul 03 '13 at 12:31
  • now i got it, with the help of struts and springs we can maintain with single view – siva Jul 04 '13 at 07:59
  • @siva good work .... Now if this answer helped kindly upvote or correct accordingly.... – IronManGill Jul 04 '13 at 08:06
  • i have some small doubts if ia add some thing programatically i know there are resizing masks we have to use them for each subview,and if i want to change some buttons height i will do it in - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {} i will do in this but for my project the orientation is not working – siva Jul 04 '13 at 12:09
  • - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations //return (interfaceOrientation == UIInterfaceOrientationPortrait); return YES; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { } else { } } these not called while my view is loading – siva Jul 04 '13 at 12:14
  • my project is tabbar controller based and is there any problem for this – siva Jul 04 '13 at 12:37
  • are you using ios 6 ? In that case they will not be called be see the latest delegates for ios 6 and add your conditions in them... – IronManGill Jul 04 '13 at 12:44
  • the view as appearing in landscape mode in nib file is not apppearing when i run the project, in my project i have mainwindow.xib file is there any problem with this – siva Jul 05 '13 at 04:47
  • Please check the status bar orientation in the appdelegate to see in which orientation your app will launch.... – IronManGill Jul 05 '13 at 04:49
  • my app is lauching in portriat mode only,because i keep portriat mode in info.plist file of my target settings. but how to check staus bar orientation in appdelegate file – siva Jul 05 '13 at 04:54
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/32921/discussion-between-ironmangill-and-siva) – IronManGill Jul 05 '13 at 04:55
  • still iam not getting in ios 5 but it is fine in ios 6 – siva Jul 05 '13 at 08:57