Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/happymaa/public_html/coderchrismills.com/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340
May 2011 – Chris Mills 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>…