objective-c

My roadmap for next months

This little post is to present you what I intend to work on for the next months.

As I will be quite busy due to personal and good reasons, I won't be able to make big updates for the time being. So I will focus on some small, maintenance related, application updates, intended to facilitate iOS 8 migration when the time will come.

Read moreā€¦

Delegation

As I am writing from my phone, today's article will be short.

When creating your cocoa's application, you will often be asked to set a delegate object. This is not specific to objective-c development.

I will take a simple example : a table. There exists two ways two create cells in a table. The first one is active, we tell the table to add a cell, and we do so for each cell. The second one is passive. When the table want to be draw or updated, he ask our code what it should do.

How many rows should I have? What cell should I display there? What should I do when my cell is selected?

That is delegation. The answers are given by an instance of a class implementing an interface. This object is the delegate.

As a matter of fact, in iOS development, a UITableView use a double delegation. The delegate defines the behavior while the datasource defines the content.