iOS 7, Apple's latest operating system for iOS devices, introduced quite a few changes to the user interface that can make mobile app developers go crazy when trying to support iOS7 without having to completely re-examine the code. Some changes are so obvious to the user that require immedaite attention from the mobile developer. For instance, all iOS 7 apps are now full screen, meaning that their window gets overlapped by the status bar (the bar holding your clock, wifi status, etc). While Apple has made it relatively easy to convert apps to the new version of iOS, there may be situations where it's not that easy to convert or adapt the UI of your app. Here are 5 quick tips and tricks that will help you with this endeavor.
If you want to have less headaches when adding support to iOS 7, you should really stop supporting the older versions of iOS 5 and below.
Those older versions of iOS have many changes to the API which would make your code difficult to maintain.
So first move all your code to support iOS 6 and then you can start by adding support for iOS 7. Also, when it comes to the UI, iOS 6 has a technology that is not available in older versions.
Besides, all devices that supported iOS 4 and iOS 5 also support version 6. And it's a free update for iPhone, iPad and iPod touch so there is no point to keep supporting the older versions.
I am a big fan of this technology. Before iOS 6, we had what Apple called the springs and struts. These were good but would cause problems when your layout had to change. For instance when you added a new language to your app, chances were that the label was too small and then you had to resort to coding to fix that.
Actually, many developers preferred to do their layouts by coding, which resulted in all kinds of bugs that were difficult to resolve.
With Auto Layout this becomes a thing of the past. You basically just set a few rules (called constraints) and the system takes care of rest.
This is not saying that you can't use coding. In some cases you even need to make your layout by coding. But instead of telling your UI elements where they should be positioned, you are telling them how they should behave with the other UI elements.
You can even use Auto Layout to animate your UI by adding or removing constraints. And when it comes to supporting iOS 7, you really don't need to do much to your UI to have it look like before.
For more information about Auto Layout I encourage you to read this page: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/Introduction/Introduction.html
As you know, all iOS 7 mobile apps have one thing in common; their window is now full screen. This means that the status bar is now overlapping the app. But what if you don't want this behavior?
Fortunately there is a solution to this. In iOS 7, UIViewController has a method called edgesForExtendedLayout and you use it by writing this code:
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) { // check is iOS supports this self.edgesForExtendedLayout = UIRectEdgeNone;}By doing this, you prevent the window to go under the status bar. Easy one liner which will save you lots of trouble!
You may be tempted to just create UINavigationBar either programmatically or using Interface Builder and add it to your view controller's view. Please DON'T!
Instead wrap your view controller in a UINavigationController and let the system create a navigation bar for you. This will make it look better in iOS 7. On iOS 6 you won't see any difference.
Use this method even if your view controller won't be used for navigating between other view controllers. It's a good practice!
This tip is not specific to iOS 7, but it will help you have a standard UI on both iOS 6 and 7.
Almost all UI elements in your mobile app have an "appearance" proxy which you can use to change how a UI element looks. Things like title color, background color, font, etc… can all be changed (depending on the element).
This is useful if you want your iOS 6 mobile app look the same on iOS 7 or vice versa.
You should really take a look into this, it's really useful.
Adapting your mobile app to iOS 7 is really not that hard. There are just a few things that you need to take care of but in general it should be pretty fast to get your app up and running on Apple's new version of iOS.
I hope you found these tips useful, although I'm sure I'm missing a few. In that case please share it with us.
Until next time!
Jesus De Meyer has a Bachelor's degree in Multimedia and Communication Technology from the PIH University in Kortrijk, Belgium. He has 15 years of experience developing software applications for Mac and more than 5 years in iOS mobile app development. He currently works at iTexico as an iOS Mobile App Developer and in his spare time he works on his own mobile apps.
No comments:
Post a Comment