Press "Enter" to skip to content

Month: May 2011

Basic Delegate Example

There are two things that I have recently grown to love when it comes to writing iOS code and those are Protocols and Delegates. If you written anything with a UITableView in it , then you’ve used Protocols before. For instance, cellForRowAtIndexPath is in fact a method that is defined in the UITableViewDataSource protocol. You’ve been using protocols this whole time and didn’t even know it, or maybe you did. So how do you make your own Protocol and Delegates? It’s actually fairly boilerplate and super simple. Here is a simple example. Definition [sourcecode language=”objc”] #import <Foundation/Foundation.h> @protocol MyClassDelegate <NSObject>…

Continue reading Basic Delegate Example