iPhone开发经典语录


1 : 如果无法保证子类行为的一致性,那么就用委托
If the subClass can’t keep with superClass,use delegate rather than inheritance.
 
 
2: 屏 幕上看到的,都是 UIVew
Everything you see on Screen is UIView.
 

3: 如 果对性能要求高,慎用 Interface Build(Xcode 4.2.1已经变了,冒似没有Interface Builder的概念了)
if application’s performance is important,be discreet for the interface build.
 

4:copy 是创建, retain 是引用
the copy operation is create a new one,but the retain operation is just a reference.
 
 
5 : alloc 需要 release,convenient 不需要 release
alloc method need corresponding release method,but convenient method not.
 

6: 加 载到 NSArray/NSMutableArray 里的对象,不需要负责 release(即在dealloc的时候不需要调用[instanceArray removeAllobjects];来清空数组里面的对象成员。instanceArray为NSArray/NSMutableArray类型的对象。主要是考虑到可能有多个应用对象在共享instanceArray数组。其中一个应用退出时,调用dealloc时如果removeAllobjects移除了所有对象成员,另外一共享该instanceArray数组的应用可能就会引用到已经不存在的对象成员,会报错,并且当该应用退出时,也会dealloc,会再次removeAllobjects,对一个已经移除了所有对象成员的数组(固定长度或可变长度)再次调用removeAllobjects来清空成员,不知道会不会有问题,有时间写个例子试一下~!!!)
The objects added to NSArray/NSMutableArray need not to be released.
 

7:IBOutlet,IBAction 为你开启了访问 Interface Build 中对象的大门
IBOutlet and IBAction open the door to access the objects in Interface build.
 
 
8:UIApplicationDelegate 负责应用程序的生命周期,而 UIViewController 负责 View 的生命周期
UIApplicationDelegate is responsible for the application life cycle,but UIViewController for the UIView.
 

9: 为 了程序的健壮性,请尽量实现 Delegate 的生命周期函数
if you want to develop a robust application,implement the life cycle methods as more as possbile.

10: 哥 触摸的不是 UIEvent, 而是 NSSet 的 UIView

what you touch on screen is not UIEvent but UIView

注:原文转自:http://blog.csdn.net/duanyipeng/article/details/7165774