3k

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年5月26日

摘要: 本文主要是阐述一下Block中如何的使用外部变量以及block本身的内存管理。先定义一个block变量,作为后续的例子中使用: typedefvoid(^BlockCC)(void); BlockCC_block;1、block中引用外部变量block中可以直接使用外部的变量,比如 intnumber=1; _block=^(){ NSLog(@"number%d",number); };那么实际上,在block生成的时候,是会把number当做是常量变量编码到block当中。可以看到,以下的代码,block中的number值是不会发生变化的: int... 阅读全文

posted @ 2012-05-26 17:26 3k 阅读(164) 评论(0) 推荐(0)

摘要: If you terminate your app by pressing the home button (in the Simulator or on the device), your User Defaults will get saved.If you terminate your app by pressing "Stop" in Xcode (in the Simulator or on the device), your User Defaultsmightget saved, but there's a good chance they won&# 阅读全文

posted @ 2012-05-26 17:17 3k 阅读(133) 评论(0) 推荐(0)