知识点

作者: 苒妈 | 来源:发表于2016-03-08 14:09 被阅读33次

1.#import 和#include区别

2.类之间如何传递参数?代理和通知有什么区别?

3.如何识别一段文字中的url,怎样实现点击url,并且更换url的颜色?

4.bound和frame使用

5.多线程的实现方法

6.strong,copy,assign,weak使用

7.@property (copy) NSMutableArray *array;会有什么问题?

8.成员变量,实例变量,@synthesize

9.atomic一定是线程安全吗?

10.CALayer和UIView的关系

11.runtime

12.KVC, KVO


第1题,#import是Objective-c中改进的引入头文件方法,可以确保不会重复引入头文件,避免循环引入的问题。

第2题,通过delegate和notication两种都可以。最大的区别就是delegate是1对1,notification可以是1对多。另外,delegate可以传递类中的其他值,notification只能是变化的值。

第5题,通过Thread,GCD,NSOperation和NSOperationQueue都可以实现多线程。

第6题,

参考http://www.jianshu.com/p/4e327d1832ef

http://bihongbo.com/2014/05/20/IOSassignandweak/

https://github.com/ChenYilong/iOSInterviewQuestions

栈 和 堆 的区别:http://blog.csdn.net/hairetz/article/details/4141043

(1)@property默认值atomic,readwrite,assign。

(2)NSArray,NSDictionary,NSString 存在可变类型,如果将一个可变类型的值赋值给NSArray,NSArray的值修改会导致原NSMutable的值修改。为避免可变类型赋值操作中的无意变动,应该用copy拷贝一份。

NSMutableArray, NSMutableDictionary等可变类型,应该用strong,因为,mutable 类型copy总是得到immutable值。

(3)block通常都是用copy。MRC中需要将block先拷贝到堆中(历史遗留),用strong也是同样需要拷贝。

(4)delegate是用weak,避免野指针调用。

assign和weak区别,weak当所指向的内容内存计数为0时,会自动赋值nil,但是assign不会。

@property (nonatomic, weak, nullable) id <UITableViewDelegate> delegate;

第7题,两个问题,a.使用atomic同步锁,会在创建的过程中生成额外的代码用于多线程,带来性能问题,可以使用nonatomic节省很少但是不必要的额外开销。

第9题,http://blog.csdn.net/chenyufeng1991/article/details/49687215

第10题,MVC关系。 http://www.jianshu.com/p/6351116c2d19

第11题,

BOOL class_addMethod(Class cls, SEL name, IMP imp, const char * types)

Adds a new method to a class with a given name and implementatin.

Return Value

YES if the method was added successfully, otherwise NO(for example, the class already contains a method implementation with that name).

Discussion

class_addMethod will add an override of a superclass's implementation, but will not replace an existing implementation in this class.To change an existing implementation, use method_setImplementation.

如:class_addMethod([self class], @selector(resolveThisMethodDynamically), (IMP)myMethodIMP, "v@:");

An Objective-C method is simply a C function that take an lease two arguments-self and _cmd. For example, void myMethodIMP(id self, SEL _cmd)    (v:void @:id  ::SEL)

官方文档:

https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html#//apple_ref/c/func/class_addMethod

Objective-c特性runtime  

http://www.jianshu.com/p/25a319aee33d

runtime详细传递 

http://tech.glowing.com/cn/objective-c-runtime/

method swizzling 

 http://tech.glowing.com/cn/method-swizzling-aop/

详细讲解logging实例  

http://blog.leichunfeng.com/blog/2015/06/14/objective-c-method-swizzling-best-practice/

class_addmethod详解 

  http://longtimenoc.com/archives/ios%E5%9C%A8%E8%BF%90%E8%A1%8C%E6%97%B6%E4%B8%BA%E7%B1%BB%E6%B7%BB%E5%8A%A0%E6%96%B9%E6%B3%95

第12题:

Apple Document:

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/KeyValueCoding/Articles/Overview.html#//apple_ref/doc/uid/20001838-SW1

KVC and KVO:

http://www.objccn.io/issue-7-3/

相关文章

  • 【文魁大脑实用记忆第二期】萧进才第20次《机械、经济学知识点》

    1、静态指标知识点 2、动态指标知识点 3、不确定分析知识点 4、夹具知识点 5、定位知识点

  • 普通的随笔

    在医院中的努力呃 过知识点,过知识点,过知识点

  • 测试开发知识点(三)

    传送门 测试开发知识点(一)测试开发知识点(二)测试开发知识点(三)测试开发知识点(四)测试开发知识点(五) 自动...

  • 测试开发知识点(一)

    传送门 测试开发知识点(一)测试开发知识点(二)测试开发知识点(三)测试开发知识点(四)测试开发知识点(五) 软件...

  • 测试开发知识点(二)

    传送门 测试开发知识点(一)测试开发知识点(二)测试开发知识点(三)测试开发知识点(四)测试开发知识点(五) We...

  • 面试被问到的问题

    传送门测试开发知识点(一)测试开发知识点(二)测试开发知识点(三)测试开发知识点(四)测试开发知识点(五) 1、请...

  • 前端基础知识点

    1.html常见知识点 2.css常见知识点 3.js常见知识点 数组知识点 4.计算机网络知识点 5.数据结构 ...

  • 复习 《高难度沟通》

    分享者: 复习知识点: 对知识点的理解(用你自己的话表达): 知识点的适用(使用)场景: 可以链接哪些知识点: 其...

  • 《逻辑谬误》复习知识点

    分享者: 复习知识点: 对知识点的理解(用你自己的话表达): 知识点的适用(使用)场景: 可以链接哪些知识点: 其...

  • 《批判性思维》课程复习

    分享者: 复习知识点: 对知识点的理解(用你自己的话表达): 知识点的适用(使用)场景: 可以链接哪些知识点: 其...

网友评论

      本文标题:知识点

      本文链接:https://www.haomeiwen.com/subject/drkzkttx.html