Avoid Properties in Categories Objective-C分类中是不允许增加成员变量的(Instance variables may not be placed in categories),我们可以通过运行时函数objc_setAssociatedObject 和 objc_getAssociatedObject 来让分类支持保存和获取一些数据,从而支持属性. //EOCPerson+FriendShip.h @interface EOCPerson (FriendS…
是一个概念 Stored Properties and Instance Variables If you have experience with Objective-C, you may know that it provides two ways to store values and references as part of a class instance. In addition to properties, you can use instance variables as a…
Dogs have many shared characteristics, like the abilities to wag their tails and drink water from a bowl, but they also have information about them that is variable, like their breed or their name. Similarly, when designing an application, your users…
https://github.com/unixc3t/mydoc/blob/master/blog/caiv.md…
网上看到的 http://esoftmobile.com/2013/08/10/effective-objective-c/ 本文是针对<Effective Objective-C>一书的代码解读,笔者并没有看过原书,只是通过阅读该书的代码,并结合相应的主题,来臆测作者可能要表达的内容并用自己的语言来描述出来. Chapter 1: Accustoming Yourself to Objective-C Item 1: Familiarize Yourself with Objective-C…
Objective -C Categories  The dynamic runtime dispatch mechanism employed by Objective-C lets you add methods to existing classes. 被Objective -C 采纳的动态运行分配机制让你可以在已有的类中添加方法. 1.1 Creating a Category 创建一个Category  A category is a way to add new methods to…
>>> class CObj(object):... pass...>>> dir()['CObj', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__']>>> cob = CObj>>> dir()['CObj', '__builtins__', '__doc__', '__loader__', '__name__', '__…
When calling an instance method like withdraw_securely, the syntax generally looks something like this: object.method_being_called(arguments) One would therefore think it’s safe to assume that an instance method is always preceded by a ., which is in…
Blocks and Variables https://developer.apple.com/library/ios/documentation/cocoa/conceptual/Blocks/Articles/bxVariables.html http://stackoverflow.com/questions/16149653/what-is-the-role-of-the-copy-in-the-arc This article describes the interaction be…
Class A blueprint defining the charactaristics and behaviors of an object of that class type. Class names should be written in CamelCase, starting with a capital letter. class MyClass{ ... } Each class has two types of variables: class variables and…