Tuesday, April 8, 2014

Frequently used Design pattern used in iPhone Programming [ iPhone ] [ iOS ]

Model View Controller 

Model encapsulates the data for the application, the View presents and manages the user interface and the Controller provides the basic logic for the application and acts as the go-between, providing instructions to the Model based on user interactions with the View and updating the View to reflect responses from the Model. 
the Model knows absolutely nothing about the presentation of the application. View knows nothing about the data and logic model of the application.
App can consist of multiple view objects, controller objects and model objects.
view controller object interacts with a Model is through the methods and properties exposed by that model object.

Target-Action pattern

In the Target-action design pattern the object contains the necessary information to send a message to another object when an event occurs.  where a computer program is divided up into objects which dynamically establish relationships by telling each other which object they should target and what action or message to send to that target when an event occurs. This is especially useful when implementing graphical user interfaces, which are by nature event-driven.
Action methods are declared using the IBAction keyword. and targets are declared using 
IBOutlets.  Here IB is for interface builder.

Subclassing


Subclassing allows us to create a new class by deriving from an existing class and then extending the functionality. we get all the functionality of the parent class combined with the ability to extend the new class with additional methods and properties.

Delegation



Delegation allows an object to pass the responsibility for performing one or more tasks on to another object. This allows the behavior of an object to be modified without having to go through the process of subclassing it.

0 comments:

Post a Comment

About

Powered by Blogger.