2013年2月27日

instance variable VS local variables

摘要: The default value for instance variables in Objective-C is 0.Local variables take precedence over the instance variable and effectively hides it. 阅读全文

posted @ 2013-02-27 10:16 Chansonyan 阅读(116) 评论(0) 推荐(0)

2013年2月26日

Delegate

摘要: A Delegate is an object that's given an opportunity to react to changes in another object or influence the behavior of another object. The basic idea is that two objects coordinate to solve a problem. One object is very general and intended for reuse in a wide variety of situations. It stores a 阅读全文

posted @ 2013-02-26 01:06 Chansonyan 阅读(245) 评论(0) 推荐(0)

2013年2月25日

Notifications or Observer pattern

摘要: pp159The Notification pattern enables communication between objects without tight coupling. An object is able to broadcast information to any number of other objects without any specific information about the other objects. An instance of Cocoa's NSNotification class encapsulates the information 阅读全文

posted @ 2013-02-25 18:13 Chansonyan 阅读(201) 评论(0) 推荐(0)

Singleton

摘要: Minimal coupling is a key guiding principle of Cocoa's design and the quality that most contributes to programmer productivity.pp148The Singleton pattern is used when there must be exactly one instance of a class, and it must be easily accessible to other objects in an application. Usually, the 阅读全文

posted @ 2013-02-25 01:26 Chansonyan 阅读(214) 评论(0) 推荐(0)

2013年2月24日

Copying

摘要: pp135 这章比较水 没看懂例子。。The Copying pattern is used to create new object instances by copying existing instances.MotivationUse the Copying pattern any time you want to create a new object that is a copy of another object. Copying captures the state of an object at a moment in time.C and therefore Objecti 阅读全文

posted @ 2013-02-24 23:03 Chansonyan 阅读(279) 评论(0) 推荐(0)

Archiving and Unarchiving

摘要: pp123Archiving preserves objects including any interrelatinships or dependencise among the archived objects. Unarchiving re-created the objects and relationships that were previously archived.Archived objects are most commonly stored as binary data. Binary data tends to be fast to read and write fro 阅读全文

posted @ 2013-02-24 17:47 Chansonyan 阅读(252) 评论(0) 推荐(0)

2013年2月23日

Accessors

摘要: The Accessors pattern (also known as “setters and getters”) describes a technique forfunneling all access to an object’s properties through well-defined and easy to recognizemethods called accessorsThe Accessors pattern maximizes implementation flexibility while minimizing opportunities for errors. 阅读全文

posted @ 2013-02-23 19:08 Chansonyan 阅读(415) 评论(0) 推荐(0)

2013年2月22日

Perform Selector and Delayed Perform

摘要: Selectors identify the messages that are sent to Objective-C objects.They’re used bythe receivers of messages to select which methods will be performed.In particular, selectors are key to Cocoa’simplementation of the Notifications, Delegates,Targets and Actions, Invocations, and Forwardingpatterns. 阅读全文

posted @ 2013-02-22 16:02 Chansonyan 阅读(306) 评论(0) 推荐(0)

Enumerators

摘要: Enumerators provide a mechanism for accessing all of the objects in a collection sequentiallywithout exposing the collection’s underlying data structures. Enumerators areused to write flexible and efficient code for using collection classes without tying applicationsto specific implementations. Furt 阅读全文

posted @ 2013-02-22 01:27 Chansonyan 阅读(355) 评论(0) 推荐(0)

2013年2月21日

Anonymous Type and Heterogeneous Containers

摘要: Objective-C defines the type id, which is known as the Anonymous Type. The id type tells the compiler that a variable pointss to an object but doesn't give the compiler any more specific information about the kind of object, hence the object is anonymous.MotivationUse the Anonymous Type pattern 阅读全文

posted @ 2013-02-21 22:54 Chansonyan 阅读(274) 评论(0) 推荐(0)

导航