Tuesday, 1 March 2011

Making an iPhone app - Part 2 - iOS

Hi Readers,

This time I'm gonna introduce iOS we reveal the toolkit we have for iPhone development.

iOS is the main operation system for the iPhone (and iPad) device. What makes the difference for programming Objective-C? Check the official technical overview. There are some important aspects. iOS is closed for apps. Every app has its own sandbox environment, which is great for security, maybe not that great with flexibility, but that's a good trade-off. In iOS you have some limitations relate to the device (remember of iPhone versions). You have to prepare your app so that it can release all the unnecessary objects to gain some resource. Your app environment is signed, so you can't add new files during the app's lifetime. Obviously you can store data, but there are other solutions for that. An iOS app has response time limit, it can't be unresponsive for minutes.
And next to these restrictions you have the amazing libraries, like UIKit, the accelerometer, the media frameworks, graphical (2D/3D) frameworks and so on.

I assume you have Xcode, you do know how to write Objective-C code, it's time to learn iOS programming. Some tested sourced I encourage you to read:
[* - highly suggested]

You need some time to learn how a normal app is structured. On iOS the preferred methodology is the good old MVC or more specially the PAC modell. In UIKit you have lot's of view objects, like labels, imageviews, tables, form elements, etc. Some of the 'abstract' view object has its bundled controller, like ViewController or TableViewController. UIKit provides these pairs for a very good reason. When you work with tables or maps you almost always need a controller for handling events and set configurations. It's a huge help so you don't have to create them.

The view hierarchy starts with a window, which is the root view. You can add any view into a view object and that is how you build a ui. If an element needs control or event handling it has a high chance that it needs a controller.

You can create views in two ways: using NIB files (ends with *.xib) or creating them in code. With NIBs you can easily drag and drop ui elements on them, with a few clicks you can assign action handlers to events. In code you have the freedom to customize it towards, but obviously, it's more code and you have to be more careful with that.


In the first times you will always need a base app to play with, to try features out as fast possible and get feedback. And remember: fail always a good thing! In the next part I'll explain how you can make a minimal application you can use for testing.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.