Monday, August 4, 2014

The unfortunate iOS Developer

Hi there,

last week I was struggeling with iOS development. I was so deep into learning and coding that I simply had no nerve to write something in the blog.
It started very well. It was just me, xcode beta and the new programming language swift all together following one target: Developing my app.

What costs me most of the time was layouting.
I was coming from android development where its standard to have the xml files and a visual dummy representation, where I can see what the view will look like. That in mind I thought its a good idea to have a visual representation in the iOS app as well.
First I got in touch with the storyboard which is created by default. It was working quit ok in the beginning. Then I wanted to use a third party library which was shipped with examples based on xib files. While storyboards containing usually more than one view(-controller) a xib file contains only one. So I learned to use xib files too (just for fun, haha).

After doing this excurse I returned to storyboards and wanted to get into serious development: The plan was to position my elements and then be happy. It shouldn't be.
Unfortunately iOS is using absolute positioning in the standard views only which makes it impossible (for me) to dynamically hide and show elements. Maybe this is one reason that iOS is running so smothly compared to Android. All elements do not care about any other than themselfes.

There is a way to use constraints for hiding and showing.
Unfortunately its to big effort to make all the constraints and results in confusing code.

I realized that static table layout could be a solution. I tried to define it in the storyboard.
Unfortunately xcode has a bug that prevented me from using custom cells in the storyboard so that wasn't a solution either.

Then I was trying some third party library call QuickDialog. I got the samples to run.
Unfortunatly I wasn't able to integrate the lib into my project. Also I realized that the lib is a little bit oversized for my project.

So I decided to use the only real way: doing it in code. No visual presentation, but who cares since I'm the only one who needs to do something in the project. Doing it programmatically allows me to render elements depending on certain conditions. I really can recommend to take a look into this autolayout example library.

No comments:

Post a Comment