http://blog.csdn.net/liuzhi1218/article/details/6993135循环引用: 引用计数是一种便利的内存管理机制,但它有一个很大的缺点,那就是不能管理循环引用的对象。一个简单的例子如下:#include#include #include #include c...
分类:
其他好文 时间:
2015-02-10 15:10:00
阅读次数:
121
_weak typeof(self) weakSelf = self;
(一)内存管理原则
1、默认strong,可选weak。strong下不管成员变量还是property,每次使用指针指向一个对象,等于自动调用retain(), 并对旧对象调用release(),所以设为nil等于release。
2、只要某个对象被任一strong指针指向,那么它将不会被销毁,否则立即释放,不用等runl...
分类:
其他好文 时间:
2015-02-10 11:20:29
阅读次数:
142
1.二维码生成#import@property(weak,nonatomic)IBOutletUIImageView *QRCImage;- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{// 1.创建滤镜CIFilte...
分类:
其他好文 时间:
2015-02-07 11:41:14
阅读次数:
153
一、NSURLConnection 1.简单登陆(get请求) #import "MBProgressHUD+MJ.h"@interface HMViewController () @property (weak, nonatomic) IBOutlet UITextField *usernam.....
分类:
移动开发 时间:
2015-02-06 18:39:45
阅读次数:
177
因为自己之前在block中需要递归调用自己本身,而没有用weak。导致在[self removeFromSuperview]方法时,CPU使用率一只高达百分之百。。block一直持有self。。。fix:__weak 当前类 *weakSelf = self;[weakSelf 递归调用的方法];这...
分类:
移动开发 时间:
2015-02-05 18:16:35
阅读次数:
163
//委托的协议定义@protocol UpdateDelegate - (void)update;@end@interface Test : NSObject//委托变量定义@property (nonatomic, weak) id delegate;//blocktypedef void (^U...
分类:
移动开发 时间:
2015-02-04 10:37:53
阅读次数:
186
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 "ins...
分类:
系统相关 时间:
2015-02-03 21:12:01
阅读次数:
196
#import "ViewController.h"
#define ImageViewCount 5
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIScrollView *imageScrollView;
@property (weak, nonatomic) IBOutlet UIPageContro...
分类:
移动开发 时间:
2015-02-03 17:12:25
阅读次数:
210
下面是具体代码// ViewController.m#import "ViewController.h"@interface ViewController ()@property (nonatomic,weak) IBOutlet UITextField *text1;@property (nona...
分类:
移动开发 时间:
2015-02-03 01:49:17
阅读次数:
170
//LOL英雄展示#import "SKUIViewController"import "hero.h"@interface SKUIViewController()@property(nonatomic,strong)NSArray *heros;@property(nonatomic,weak)...
分类:
其他好文 时间:
2015-02-02 01:55:45
阅读次数:
288