NSAutoreleasePool 和 @autoreleasepool blocks 区别
来源:互联网 发布:照片调色软件 编辑:程序博客网 时间:2024/06/05 21:58
转载地址:http://www.cnblogs.com/PirateCaptain/articles/2506330.html
//// main.m// HelloWorld//// Created by Erica Sadun on 4/24/09.// Copyright __MyCompanyName__ 2009. All rights reserved./** xcode4.3引入ARC,release这块就有些变化,当你使用ARC,就必须将NSAutoreleasePool的地方换成 @autoreleasepool 关于NSAutoreleasePool的解释官方的最清楚 Important If you use Automatic Reference Counting (ARC), you cannot use autorelease pools directly. Instead, you use @autoreleasepool blocks instead. For example, in place of: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init; // Code benefitting from a local autorelease pool. [pool release]; you would write: @autoreleasepool { // Code benefitting from a local autorelease pool. } @autoreleasepool blocks are more efficient than using an instance of NSAutoreleasePool directly; you can also use them even if you do not use ARC. **/#import <UIKit/UIKit.h>#import "HelloWorldAppDelegate.h" //如果下面第二个参数直接用nil,不用import这个Delegate.h头文件也可int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog(@"nil如何调用窗口呢"); int retVal = UIApplicationMain(argc, argv, nil,nil); //等效下一句,第二个nil表示就把模板生成的Delegate类作为默认参数 //int retVal = UIApplicationMain(argc, argv, nil,NSStringFromClass([HelloWorldAppDelegate class])); [pool release]; return retVal;}
- NSAutoreleasePool 和 @autoreleasepool blocks 区别
- @autoreleasepool 代替 NSAutoreleasepool
- NSAutoreleasePool的release和drain的区别
- NSAutoreleasePool的release和drain的区别
- Are @autoreleasepool Blocks More Efficient?
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- NSAutoReleasePool使用中drain和release的区别
- @autoreleasepool在ARC和MRC下的区别
- @autoreleasepool在ARC和MRC下的区别
- @autoreleasepool在ARC和MRC下的区别
- @autoreleasepool in Loop 和 Loop in @autoreleasepool
- Runloop和AutoreleasePool
- NSAutoreleasepool
- NSAutoreleasePool
- iSCSI
- Java 7从入门到精通 目录结构
- XCode4.0之HelloWorld创建及说明----------同样适合XCode4.6.2
- 使用Maven管理依赖JAR文件,自定义项目布局,利用ANT生成不同的发布包
- Oracle Profile 使用详解
- NSAutoreleasePool 和 @autoreleasepool blocks 区别
- 底层网络(3)------高级接口
- 题目1512:用两个栈实现队列 && 包含min函数的栈
- cocos2d-x 实现 愤怒的小鸟 橡皮筋
- UVA-10405-Longest Common Subsequence
- Oracle Database Patchset Numbers
- Oracle Hint
- Haxe2.10到Haxe3,NME到OpenFL的迁移备忘
- 用grep查找文件内容