zoukankan      html  css  js  c++  java
  • iOS.ObjC.Basic-Knowledge

    1. ObjC的基础 

    2. ObjC2.0中的编译指令

    3. ObjC Runtime

    4. ObjC Object Model

    5. ObjC的新语法

    6. FQA

    1. ObjC的基础

    2. ObjC2.0中的编译指令

    http://www.learn-cocos2d.com/2011/10/complete-list-objectivec-20-compiler-directives/

    http://developer.apple.com/library/mac/#releasenotes/Cocoa/RN-ObjectiveC/index.html

    3. ObjC Runtime

    3.1 class method 中的self 和 instance method中的self不同点在哪?

    Within the body of a class method, self refers to the class object itself.

    参见: https://developer.apple.com/library/ios/documentation/general/conceptual/DevPedia-CocoaCore/ClassMethod.html

    3.2 metaclass

    http://www.cocoawithlove.com/2010/01/what-is-meta-class-in-objective-c.html

    Class and metaclass:

    http://www.sealiesoftware.com/blog/archive/2009/04/14/objc_explain_Classes_and_metaclasses.html

    http://resources.infosecinstitute.com/ios-application-security-part-3-understanding-the-objective-c-runtime/

    4. ObjC的新语法

    4.1 属性只需要声明(使用property指令), 而不需要@synthesize指令,那么会发生什么?

    @interface Context : NSObject

    @property (nonatomic, strong) NSMutableString *text;

    4.2 @import

    例如:

    @import UIKit

    4.X Modern Objective-C: WWDC 2012 Session 405 (TODO)

    5. QA

    5.1 NSCopying NSMutableCopying

    Implement "- (id)copyWithZone:(NSZone *)zone"  for immutalbe object. 

    ARC:

     - (id) copyWithZone:(NSZone *)zone { return self; } 

    MRC:

     -(id) copyWithZone:(NSZone*)zone { return[self retain]; } 

    - (id)mutableCopyWithZone:(NSZone *)zone

    Ref:

    A. POP, POPAnimatableProperty类 

    B. http://stackoverflow.com/questions/9127198/objective-c-immutable-object-copywithzone-arc-compatible-realization

    5.2

    NS_RETURNS_RETAINED  

    NS_RETURNS_NOT_RETAINED 

    CF_RETURNS_RETAINED

    CF_RETURNS_NOT_RETAINED

    NS_RELEASES_ARGUMENT

    CF_RELEASES_ARGUMENT

    Ref

    A. http://clang-analyzer.llvm.org/annotations.html

    B. http://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-object-operands-retained-return-values

    5.3

    NSObject的接口

    "+ (id)allocWithZone:(struct _NSZone *)zone" 在子类该如何实现呢,该接口在ObjC中是什么作用?

    ---
  • 相关阅读:
    Windows Azure 网站开发Stacks支持
    AzureDev 社区活动获奖者公布
    Android 改变窗口标题栏的布局
    cocos2d-x游戏开发系列教程-超级玛丽01-前言
    cocos2dx进阶学习之CCObject
    基于visual Studio2013解决算法导论之055拓扑排序
    查看某文件夹内文件大小
    vmstat命令
    uname 命令
    iostat命令
  • 原文地址:https://www.cnblogs.com/cwgk/p/3196560.html
Copyright © 2011-2022 走看看