#import "ViewController.h"
@interface ViewController ()
@property(nonatomic,weak)IBOutlet UIButton *button;
@property(nonatomic,weak)IBOutlet UIImageView *imageView;
@end
@implementation ViewCo...
分类:
其他好文 时间:
2015-08-30 01:01:23
阅读次数:
164
在iOS开发的过程中,我们一般不用retain,和assign,而是用strong和weak,这时候,我们可以把strong理解为retain,而weak理解为assign,比较容易理解。
在ARC情况下:
Strong
和weak:
如果一个对象同时被两个指针所引用,例如:
Object *b1 = [[Object alloc]initAge:23];
O...
分类:
其他好文 时间:
2015-08-29 18:53:14
阅读次数:
278
#import "ViewController.h"@interface ViewController ()@property(nonatomic,weak)IBOutlet UIButton *button;@property(nonatomic,weak)IBOutlet UIImageView...
分类:
其他好文 时间:
2015-08-29 15:16:04
阅读次数:
157
#import "ViewController.h"
@interface ViewController ()
@property(nonatomic,weak)IBOutlet UIButton *button;
@property(nonatomic,weak)IBOutlet UIImageView *imageView;
@end
@implementation ViewCo...
分类:
其他好文 时间:
2015-08-29 14:03:17
阅读次数:
121
一、字典转模型(plist文件)模型的封装方法:(放到代码仓库中)1.在.h文件中添加与plist文件key值对应的属性名Array --- > NSArray
Dictionary --- > NSDictionary
string ---> NSString
number ---> NSNumber注意:属性名和plist中key值一定要一致2..h文件文件中属性的strong weak cop...
分类:
移动开发 时间:
2015-08-29 06:21:31
阅读次数:
188
1 #import "ViewController.h" 2 #import 3 4 @interface ViewController () 5 @property (weak, nonatomic) IBOutlet UILabel *nameLabel; 6 @proper...
分类:
其他好文 时间:
2015-08-28 15:12:51
阅读次数:
138
strong与weak是由ARC新引入的对象变量属性
xcode 4.2(ios sdk4.3和以下版本)和之前的版本使用的是retain和assign,是不支持ARC的。xcode 4.3(ios5和以上版本)之后就有了ARC,并且开始使用
strong与weak
assign: 用于非指针变量。用于
基础数据类型 (例如NSInteger)和C数据类型(int,...
分类:
其他好文 时间:
2015-08-27 13:28:18
阅读次数:
188
strong与weak是由ARC新引入的对象变量属性xcode 4.2(ios sdk4.3和以下版本)和之前的版本使用的是retain和assign,是不支持ARC的。xcode 4.3(ios5和以上版本)之后就有了ARC,并且开始使用strong与weakassign: 用于非指针变量。用于基...
分类:
其他好文 时间:
2015-08-27 12:33:34
阅读次数:
81
C++没有提供垃圾回收机制,C++11提供的智能指针能够在一定程度上解决C++内存泄漏的问题。C++11提供了共享智能指针(shared_ptr),独占智能指针(unique_ptr),弱引用指针指针(weak_ptr),使用时需要引用智能指针本质上存储动态分配(堆)对象的指正的模板类,用于对堆对象...
分类:
编程语言 时间:
2015-08-26 15:20:36
阅读次数:
338
iOS5中加入了新知识,就是ARC,其实我并不是很喜欢它,因为习惯了自己管理内存。但是学习还是很有必要的。
在iOS开发过程中,属性的定义往往与retain, assign, copy有关,我想大家都很熟悉了,在此我也不介绍,网上有很多相关文章。
现在我们看看iOS5中新的关键字strong, weak, unsafe_unretained. 可以与以前的关键字对应学习strong与r...
分类:
移动开发 时间:
2015-08-26 12:14:57
阅读次数:
180