runtime 使用情况(一)
来源:互联网 发布:差不多先生 知乎 编辑:程序博客网 时间:2024/06/03 18:31
动态运行时添加方法,可能大家都知道,但是何时使用,可能不是很清楚。其中一种运用情况就是支持新旧两种API。
- (void)doSomething { // legacy code goes here...}- (void)doSomethingWithNewAPI { // do the same thing, but use new API.}+ (void)initialise { //check self if (self != [MyObject class]) return; //check if support newAPI if ([[SomeSystemClass instancesResponsedToSelector:@selector(theNewAPI)] == NO)] return; Method legacy = class_getInstanceMethod(self, @selector(doSomething)); Method newAPI = class_getInstanceMethod(self, @selector(doSomethingWithNewAPI)); //change two methods method_exchangeImplementations(legacy, newAPI);}
0 0
- runtime 使用情况(一)
- 使用Runtime监控内存使用情况
- Runtime监控项目内存使用情况
- Runtime(一)
- runtime(一)
- IOS Runtime(一)
- Runtime(一)
- Runtime简介(一)
- runtime(一)
- Runtime(一)
- Runtime入门(一)
- Runtime(一)
- iOS Runtime(一)
- 系统管理(一) 查看系统使用情况
- RunTime机制详解(一)
- Runtime系列(一)-- 基础知识
- iOS Runtime总结(一)
- Objective-C Runtime(一)
- 毕设第三周(Pregel in GraphX以及Shortest Path)
- 学习笔记七之网络编程(TCP)
- 安装qemu
- CSS+DIV之1-10
- Python3.x和Python2.x的区别
- runtime 使用情况(一)
- 学习笔记三之进程控制
- JSP九大内置对象
- 学习笔记二之文件与时间编程
- awk-排序(asort,asorti)
- 输入某年某月某日,判断这一天是这一年的第几天(java)
- 欢迎使用CSDN-markdown编辑器
- 杭电acm1028
- CodeTyphon32中自带例子源码:可拖动及调整属性的图像对象