iOS7 Version compatibility

Published by Brad on

Recently while updating A LOT of our apps I see that one of the main issues is the content going under a UINavigationController. It appears the solution is rather easy and quick to fix.
public override void ViewDidLoad ()
{
	base.ViewDidLoad ();

	EdgesForExtendedLayout = UIRectEdge.None;
}
This works a treat in most instances, however your app will no longer be compatible with iOS6 and below devices. This is because EdgesForExtendedLayout was added in iOS7. A simple fix for this is to only allow it to run if you are on iOS7 or later. The best way I have found for this is with a CheckSystemVersion method.
public override void ViewDidLoad ()
{
	base.ViewDidLoad ();

	if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
	{
		EdgesForExtendedLayout = UIRectEdge.None;
	}
}
It is also rather handy if you want to use something that is in iOS6 but not iOS5.

0 Comments

Leave a Reply

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