Blocks and Grand Central Dispatch

Cocoa Samurai’s article published in 2009, by Colin Wheeler, talk about Blocks, Grand Central Dispatch, GCD Design Patterns and Cocoa API’s using GCD and Blocks. In 2009, the methods expose in this article are based on OS X 10.6, however, with the increased interaction of the Mac and iPhone with web services, data cloud, etc.., these...

Code: iOS Freehand Drawing Part 1

There is some cases where we need to make a freehand drawing in our apps, for example to make a signature. This will be the first part of three post that will allow you to draw in a freehand way. Lets go! 1) Set up your project. If you don't know how to start maybe it's not your...

Code: Custom UIView from xib

If you are building a complex view, you can break it down in parts to make more readable the code and split the functionality on different UIView classes. Then you can instantiate your subviews from your main UIViewController.

Code: Custom pins in your map

Sometimes you need to add a custom pin to your map. You can use this piece of code to achieve that. Take a special look to the property "centerOffset" that allows to adjust your image from the center of your MKAnnotationView (usually you will set it as (0 , minus half...

Theory: Delegate patterns in Cocoa

The delegate pattern is a common and useful pattern in cocoa's environment like  properties and will be easy to implement if you have clear what you want to do. The first thing we need to know will be the concept of 'protocol', this is basically a declaration which methods are between two classes and...