__weak?__typeof(self)weakSelf??=?self;
分类:
其他好文 时间:
2015-10-30 15:43:41
阅读次数:
127
#import "EDRViewController.h"@interface EDRViewController ()@property(nonatomic,weak) UIWebView * webView;@end@implementation EDRViewController- (void...
分类:
移动开发 时间:
2015-10-30 15:25:51
阅读次数:
261
使用keyObj 生成 weak_key 作为 map 里存储的key, 这样 keyObj对象可以随时被回收; 但是这样的话,key 对应的value 还在 map 中,所以value 不能自由回收; 所以weak_key 关联 ReferenceQueue, 这样 keyObj...
分类:
其他好文 时间:
2015-10-29 20:21:32
阅读次数:
262
现在的项目是手动内存管理,所以在引入第三方资源库时候,很多资源库更新以后都开始使用arc进行编码,这样就导致两种代码风格不一致,有的时候可能开发者也没有注意到这些问题,反正用的时候也没有报错,就直接使用了;但是有的时候,因为arc编码中用到了新的属性修饰符,例如weak,这时候在手动管理内存的代码....
分类:
移动开发 时间:
2015-10-29 12:57:21
阅读次数:
230
import UIKit class ViewController: UIViewController { @IBOutlet weak var toolBar: UIToolbar! @IBOutlet weak var addActionLabel: UILabel! override ...
分类:
编程语言 时间:
2015-10-28 21:13:50
阅读次数:
312
#import "ViewController.h"#import "Person.h"#import "Student.h"@interface ViewController (){ NSString *_text;}@property (weak, nonatomic) IBOutlet ...
分类:
移动开发 时间:
2015-10-27 15:15:22
阅读次数:
188
在定义delegate对象的时候,我们经常看到可以使用weak 和 assign 但是到底哪个使用更合适呢?首先:使用assign,声明的对象即使对象销毁了,但是指针依然存在,这样造成声明的对象变成了野指针,这样导致内存泄露。而使用 weak ,当对象销毁时,即将delegate = nil,这样不...
分类:
移动开发 时间:
2015-10-27 13:03:25
阅读次数:
206
1.scrollView缩放#import "ViewController.h"@interface ViewController () @property (weak, nonatomic) IBOutlet UIScrollView *scrollView;@property (weak, no...
分类:
移动开发 时间:
2015-10-26 01:54:27
阅读次数:
219
https://msdn.microsoft.com/en-US/library/aa970850(v=vs.100).aspxIn applications, it is possible that handlers that are attached to event sources will ...
分类:
其他好文 时间:
2015-10-21 22:23:27
阅读次数:
231
New stuff learnt - Union-Find. Simpler and more elegant than I thought.class Solution { unordered_map father; int find(int val) { if(!...
分类:
其他好文 时间:
2015-10-21 14:08:51
阅读次数:
191