0

I have implemented one universal iOS app for both iPad & iPhone that supports iOS6 & iOS7 in Portrait mode.
Now my new task is to support landscape mode for this app also.
These views are not Auto Layout enabled.

My question is, Is there any great solution for orientation instead of implementing all orientation methods and writing code in each UIViewController class?
I have used too many controls in each XIB file. Please make suggestions to me.

csharpwinphonexaml
  • 3,659
  • 10
  • 32
  • 63
Ganesh G
  • 1,991
  • 1
  • 24
  • 37

1 Answers1

0

Autolayout is probably your best option. If you haven't been exposed to autolayout before I suggest reading a tutorial on RayWenderlich.com and watching the autolayout videos from the past 2 or three WWDC's. Several of the 'beginning autolayout' videos address the problem your facing.

Brandon
  • 2,387
  • 13
  • 25
  • Thanks for replying. If I include AutoLayout in my app then it would be problem to support iOS6 and iOS7. – Ganesh G May 07 '14 at 12:30
  • Why would autolayout be a problem to support in iOS 6 and 7? It works in both versions. – Brandon May 07 '14 at 14:46
  • No. There is a problem with Status bar when we migrate code supporting form iOS6 to iOS7. So to resolve this problem I used delta values as mentioned in the link http://stackoverflow.com/questions/18980925/status-bar-and-navigation-bar-issue-in-ios7 – Ganesh G May 08 '14 at 06:35
  • You can still use autolayout to address the status bar problem by leveraging the topLayoutGuide. Apple addresses this in a q&a https://developer.apple.com/library/iOS/qa/qa1797/_index.html – Brandon May 09 '14 at 04:33
  • Thank you very much @user2766755. I will give it a try. I have one more doubt is that am using many controls such as labels, textfields, scrollView, image views and ect. in each VIEW. Do I face any problem If use AutoLayout? as once we decide I would be on time line and con't back for another solution. Please help me. – Ganesh G May 09 '14 at 07:22
  • Also please let me know what are the problems I will face if I use Orientation methods in each UIViewController class. – Ganesh G May 09 '14 at 07:32
  • There are potential performance implications when using autolayout with lots of nested subviews. Most of the time this shouldn't be an issue, and it only affects the current visible views. If you decide to implement orientation methods in each view controller then that is just a lot more code you have to write and maintain. Autolayout is probably more work up front but has advantages in the future. – Brandon May 09 '14 at 15:33
  • Thank you very much @ user2766755. – Ganesh G May 19 '14 at 09:57