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中是什么作用?
iOS.ObjC.Basic-Knowledge的更多相关文章
- iOS进行Basic认证与NTLM认证
一.iOS进行Basic认证 只需要在NSMutableURLRequest的Header中添加认证所需的Username和password. NSMutableURLRequest *webReq ...
- NLP related basic knowledge with deep learning methods
NLP related basic knowledge with deep learning methods 2017-06-22 First things first >>> ...
- Python基础知识(Basic knowledge)
Python基础知识(Basic knowledge) 1.认识Python&基础环境搭建 2.Python基础(上) 3.Python基础(中) 4.Python基础(下) 5.Python ...
- iOS.ObjC.Compiler.Directives
Objective-C Compiler Directives @dynamic "You use the @dynamic keyword to tell the compiler tha ...
- 计算机基础知识 一 Basic knowledge of computers One
计算机硬件由CPU(Central Processing Unit).存储器.输入设备.输出设备组成. CPU通常由控制单元(控制器)和算数逻辑单元(运算器)组成. 运算器:负责进行算数运算和逻辑运算 ...
- iOS Objc Runtime 教程+实例Demo
样例Demo 欢迎给我star!我会继续分享的. 概述 Objc Runtime使得C具有了面向对象能力,在程序执行时创建,检查.改动类.对象和它们的方法.Runtime是C和汇编编写的,这里http ...
- Android Studio accelerator key(shortcut)& Basic knowledge
shift + F6 重构(选文件,ok->下面的控制台,do refactor option + return 快速修复 Activity@Extra() Intent: @FragmentA ...
- NoSql basic knowledge
The big picture to keep in mind first is: There are lots of articles and resources out there: http:/ ...
- [Tango] Basic Knowledge
Project Tango类设备能够给开发者在哪些领域带来机会. 室内导航*:室内GPS信号的缺失,使得Project Tango设备会成为室内导航重要应用场景之一.有了它,你就不会在不熟悉的室内商场 ...
随机推荐
- 并发基础(十) 线程局部副本ThreadLocal之正解
本文将介绍ThreadLocal的用法,并且指出大部分人对ThreadLocal 的误区. 先来看一下ThreadLocal的API: 1.构造方法摘要 ThreadLocal(): 创建一个线程 ...
- 掩膜操作手写+API(第二天)
1.1首先是用到的理论知识: 上面是一个通用的公式,光知道上面写程序还是有点麻烦的,下面公式画的有点丑,可以表达我的观点. 1.2用到的知识点:可以边看程序边看用到的知识点: CV_Assert(); ...
- create a bootable USB stick on Ubuntu
https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu?_ga=2.141187314.17572770 ...
- Redis hash数据结构
1, 新增一个 hash 或者 新增数据 => hset key field value 2, 获取某个字段值 => hset key field 3, 获取所有字段值 => hge ...
- leetcode167
public class Solution { public int[] TwoSum(int[] numbers, int target) { Dictionary<int, int> ...
- 机器学习入门-随机森林预测温度-不同参数对结果的影响调参 1.RandomedSearchCV(随机参数组的选择) 2.GridSearchCV(网格参数搜索) 3.pprint(顺序打印) 4.rf.get_params(获得当前的输入参数)
使用了RamdomedSearchCV迭代100次,从参数组里面选择出当前最佳的参数组合 在RamdomedSearchCV的基础上,使用GridSearchCV在上面最佳参数的周围选择一些合适的参数 ...
- HttpClient获取返回类型为JSON或XML的数据
Java_HttpClient获取返回类型为JSON或XML的数据 原创 2017年04月06日 17:38:29 706 HttpClient 获取返回类型为JSON或XML的数据 使用httpco ...
- 系统批量运维管理器pexpect的使用
# pip install pexpect 或 # easy_install pexpect 1 #!/usr/bin/env python 2 import pexpect 3 child = pe ...
- 注册驱动MySQL的驱动程序
1.将驱动程序文件添加到应用项目 将驱动程序mysql-connector-Java-5.1.6-bin,复制到web应用程序的web-INF\lib下,web应用程序就可以通过JDBC接口访问MyS ...
- 【Java】JVM(三)、Java垃圾收集器
一.Minor GC.Major GC 和 Full GC Minor GC:清理新生代空间,当Eden空间不能分配时候引发Minor GC Major GC:清理老年代空间 Full GC:清理Ja ...