Skip to main content

Posts

Showing posts from April, 2012

Using delegates in Objective-C



Why use delegation?

Well when writing Objective-C programs in Xcode we are encouraged to use the MVC(Model View Controller) structure.In MVC a model cannot send messages directly to a specific controller.This can become a problem if data in your model changes independantly and you need to update this information in your view via the controller(The model must never communicate directly with the view).This is where a delegate comes in,it allows messages to be sent from the model to a controller that is not specified in the model but is rather specified by the controller,in other words the controller specifies itself.

If you dont really understand what im talking about so far ,don't worry.I didn't understand delegates either until I needed one,but hopefully by the end of this tutorial you will understand not only how to use a delegate ,but the reason you would want to use one.

Program breakdown

For this tutorial we will write a program that has a model that will change an intege…

Lion's eat RAM's

I recently purchased a Mac-mini(Yes I own a Mac now) with relatively the same hardware specs as my(well the one I work with) MacBook pro, Intel Core i5,Graphics 3000(or whatever) etc. The only difference being that the ram in the Mini was only 2GB and the Laptop has 4GB,we will come back to this later.

The MacBook Pro experience: My experience with the laptop has been great,never lagging and I really got used to using a track-pad instead of a mouse and found gestures very helpful for quick desktop management with a small screen.It was also very responsive and I keep tons of windows open all the time without problems.



 When I got my Mac Mini,I popped it out of its box and plugged it in to my standard PC peripherals,switched it on and everything worked fine ,I got a few nice surprises too,I did not expect it to come with a wireless card or built in Bluetooth,just like it does on the MacBook.

Then I tried to run Safari,iTunes and Xcode all at once(I do this often while working on the Mac…