/ XAMARIN

Xamarin and iOS – Moving to iOS 7 and Xcode 5

Apple has now decreed that all apps submitted to the store must be built on XCode5 and iOS7.

And so it shall be…

So I’ve started building our Xamarin iPhone project against said platforms. Now there is a lot of redesign that should go on with moving to iOS 7, but to tell you the truth we went for a pretty flat design to begin with, so the first port of call is just migrating straight across and getting certified as an iOS 7 app.  Once we have that done, we can spend time taking advantage of more iOS 7 features

 

MjAxMy03NDY3YWM2NzFlNzdkYTgw{.lightbox}

 

The transition has been surprisingly smooth and there have only been a few issues (so far).

1. Content disappearing behind Navigation Bar

I found in some places the content of my views were being pushed up underneath the navigation bar.   This is because in iOS 7 view controllers use full screen layout.  In my case I wasn’t going to redesign the UI at this point to handle things differently so to get around this I just set the value for EdgesForExtendedLayout to None in the ViewDidLoad of the UIViewControllers, like so:

[syntax type=”html php js css”]

public override void ViewDidLoad()

{

EdgesForExtendedLayout = UIRectEdge.None;

base.ViewDidLoad();

}[/syntax]

There is more information available on the Apple iOS 7 UI Transition Guide.

 

2. Button Labels being trimmed with ellipsis (…)

Now that buttons are so cool they don’t need chrome or borders anymore I noticed that I was getting some trimming of text happening on button labels. Like this:

Search-Ellipses{.lightbox}

After much slapping of forehead I discovered that the cause was that I was setting the UILabel.Appearance.Font property in theAppDelegate’s FinishedLaunching .  This global change was enough for iOS 7 to think that C…cel looked much better than Cancel.  Get rid of that and viola, iOS 7 is happy because it has full control again 😉

Search-Nice{.lightbox}

3. Your UISwitch custom background images are gone!

Those pretty custom backgrounds you created for your UISwitch are no longer functional.  Not a biggy really, however, I also noticed that if your BackgroundColor of your UISwitch is set to UIColor.Clear you get a nice “Googely Eye” effect when you toggle your buttons.

UIToggle{.lightbox}

Is it on, is it off… who can tell.  Anyway, looks like it’s time to bow down to iOS and let it run the show. So get rid of your UIColor.Clear!

 

I’ll let you know of any more issues I have as I do a basic port to iOS 7.  Till then anyone else got any other war stories they want to share?