Monday, 1 April 2013

Fight for the 4 inch screen

It's high time to update the StatDiary application. In order to move the service to a new server I have to update a tiny string - and fortunately because Apple is insisting to make all new apps iPhone 5 compatible I have to change the views to work on the 4 inch screen as well.

I was reading many blogpost about the subject and it seems there is no other way around but actually stretching all NIBs.

First I had to reload all background images and the loading image in PhotoShop and making a 640x1136 px^2 version of it. It was all right, had to stretch some patterns only.

Then in the XCode project you have to set the layout for each NIBs:

You will get the UI constraints now. That's a little bit tricky. But - before that you have to check your code and make sure you don't use hardcoded size values - wherever it is possible. Use the *.view.frame CGRect attribute of the parent view containers instead.

Then I've set all screen-size views to Freeform:

So it's gonna be stretched out. The you have to go through and check that all default constraints are fine.

Unfortunately I had a view where it was not expected, and I've tried and just couldn't fix it. The view had a top bar having a static height. Instead of keeping the bar on the top as it is - the constraint defined the distance between the bottom of the bar and the bottom of the screen a static distance. Which is causing an unexpected enlarged bar on taller screens:

If you delete one constraint it will be created immediately again. Also I cannot set it auto. The priority seems to have almost no effect on the layout. So it's still not ready. But - if that one problem is gonna be solved the app can be proposed to the AppStore again. So - wish me luck.



No comments:

Post a Comment