关于连线拖出来的属性后面默认带叹号和为什么我们一开始不需要给它赋值问题
@IBOutlet
weak
var display:
UILabel!
因为系统自动帮你初始化了,display是一个optional,并且在使用之前就赋了nil.对于optional后面一般不是问号吗?但是对于实际类型而言它们没有什么区别.它仍然是一个option...
分类:
编程语言 时间:
2015-06-25 14:09:47
阅读次数:
1148
模型对象归档 1 import UIKit 2 3 class ViewController: UIViewController { 4 5 6 7 @IBOutlet weak var textField: UITextField! 8 9 @IB...
分类:
移动开发 时间:
2015-06-24 23:53:04
阅读次数:
256
通用文件存储 1 import UIKit 2 3 class ViewController: UIViewController { 4 5 @IBOutlet weak var textField: UITextField! 6 7 @IBAction func bt...
分类:
移动开发 时间:
2015-06-24 23:44:52
阅读次数:
262
闭包定义闭包参数闭包返回值闭包简化 - 尾随闭包闭包的循环引用weak var weakSelf = selfdemo("zhangsan") { (_) -> Int in println(weakSelf?.view.backgroundColor) return 20}
分类:
其他好文 时间:
2015-06-24 23:44:20
阅读次数:
168
在iOS的开发过程中,使用块的地方很多也很方便,但是在使用块的过程中要注意内存泄露的问题。 在块创建的时候,会对块内的所有对象的引用计数加一,直到块销毁,所以在使用块的过程中需要我们进行处理,在这里以AFNetworking的代码举例,代码如下: __weak __typeof(self)w...
分类:
其他好文 时间:
2015-06-23 19:53:29
阅读次数:
87
父类指针可以指向子类对象//定义block别名。typedef void (^LYItemOption)(); @interface LYItemArrow : LYItem@property(nonatomic,strong) Class desController;@property(nonat...
分类:
移动开发 时间:
2015-06-23 14:59:17
阅读次数:
146
以下代码中有Xcode中常见的3种注释/**
* 阴影 注释(1)这种注释在饮用cover时会出现在解释中
*/
@property (weak,nonatomic) IBOutlet UIButton *cover;
/**
* 控制状态栏的样式
* 注释(2)
* @return UIStatusBarStyleLightContent
*/
5. (UIStatusB...
分类:
其他好文 时间:
2015-06-22 06:29:48
阅读次数:
134
#pragma mark -- 循环引用 //----------------------------------------------------------------------------------------------------
/*
某些block中,使用self会造成循环引用
__weak AppDelegate *weakSel...
分类:
其他好文 时间:
2015-06-18 13:43:04
阅读次数:
164
Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamblers...
分类:
系统相关 时间:
2015-06-16 09:26:09
阅读次数:
160
1、strong和weak
strong:强指针/强引用;默认情况下,任何指针都是强指针 ;也就是说,我们平常定义的时候Person *p =[ [Person alloc] init];都是strong;
weak:弱指针/弱引用;使用_weak修饰的指针。
ARC(自动引用计数)的判断准则:只要没有任何强指针指向,这个对象就会被销毁;
当然超过自己的作用范围也会被销毁;
但是程...
分类:
移动开发 时间:
2015-06-14 09:38:41
阅读次数:
245