Open Source: Library Allowing For Automatic Synchronization Between Portrait And Landscape Views

It doesn’t take too long after beginning iOS development to realize some of the difficulties that occur when adjusting the user interface to accommodate changes in the devices orientation. If you have multiple elements in your view then chances are you will need to make two different layouts.

This probably means you are going to have to synchronize things across both the portrait and landscape view to keep the experience seamless if the user changes orientation.

I’ve found an excellent open source project that aims to provide that same seamless experience by using the landscape and portrait views created by you as a template, and automatically applying the layout information when the view changes. The end result being that you do not have the extra work and overhead of trying to synchronize the two views somewhere within your app.

You can find the project from Michael Tyson on Github here:
https://github.com/michaeltyson/TPMultiLayoutViewController

An absolutely brilliant idea that can definitely save a lot of time.

In case you missed it, I previously mentioned Michael’s excellent library that provides a drop-in UITextField or UITextView replacement that moves out of the way automatically when the keyboard pops up.

iOS 5 by tutorials provides an extensive collection of hands-on tutorials (over 600 pages) with source code examples to help you understand the new APIs as quickly as possible.
Read more...
DeliciousTwitterFacebookLinkedInEmail

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can send a Tweet to @maniacdev on Twitter or submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

2 Responses to Open Source: Library Allowing For Automatic Synchronization Between Portrait And Landscape Views

  1. Are you familiar with autoresizingMask? Of if your layout is very difficult in different orientation you may write single function like -(void)updateUIForOrientation:(UIInterfaceOrientatione)orient and call it in willAnimateRotationToInterfaceOrientation:duration:. Don’t fight with iOS frameworks simply use it!

  2. It’s not about fighting the iOS frameworks.. this is a much easier way of doing things.  

    Check out the sample code with the library, and you’ll see that you can create two different layout’s in IB for both landscape and portrait and things sync perfectly without you having to write a method to change anything manually.

    That’s the point of the library.  On the GIthub page the author explains why their solution is better.

Click on a tab to select how you'd like to leave your comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>