在不久前看AFNetworking的源码时候发现了这么一句:
1
2
3
4
5
6
7
8
9
10
// 不知道这行代码的使用场景的同学你该去自习看看ARC的注意事项和Block的使用了
// AFNetworking的写法
__weak __typeof(&*self)weakSelf = self;
// 我之前一直这么写的
__weak __typeof...
分类:
其他好文 时间:
2015-04-28 18:29:55
阅读次数:
186
strong。weak,copy的详解对象使用strong,ui控件使用weak,字符串用copy现在使用ARC,ARC判断准则:只要没有强指针指向对象中,找个对象就会被销毁。1. Strong/weak默认情况下下是强指针 Person *person = [[Person alloc] init...
分类:
移动开发 时间:
2015-04-28 18:16:41
阅读次数:
168
iOS培训------我的c语言笔记,期待与您交流!copy,assign,strong,retain,weak,readonly,readwrite,nonatomic,atomic,unsafe_unretained的使用与区别最近在学习iOS的过程个遇到了不少问题,知道概念也看过示例代码,但是...
分类:
其他好文 时间:
2015-04-28 15:29:18
阅读次数:
149
//C++智能指针模板类复习
#include
#include
using namespace std;
//智能指针用于确保程序不存在内存和资源泄漏且是异常安全的。
//C++98中提供了auto_ptr,C++11摒弃了auto_ptr,并提出了unique_ptr 、shared_ptr、weak_ptr
void show1()
{
int* p = ne...
分类:
编程语言 时间:
2015-04-27 21:57:40
阅读次数:
247
第一步,在storyboard中拖入一个iAd BannerView控件,做好布局就ok了。第二步,将控件引用到viewController中第四步,代码部分。import UIKit
import iAd
class ViewController: UIViewController,ADBannerViewDelegate { @IBOutlet weak var MyAd: ADBanne...
分类:
移动开发 时间:
2015-04-27 09:58:26
阅读次数:
177
在ios中可以采用声明是属性来定义实例变量和属性在.h文件中直接使用@property 在.m文件中使用扩张定义内部使用的的格式位@property(参数1,参数2)类型 名称参数有三类 1.读写属性的 :(readwrite/readonly/setter=/getter=) 2....
分类:
移动开发 时间:
2015-04-25 21:01:06
阅读次数:
178
nomantic、copy、retain等属性见前面的文章
今天看__unsafe_unretain、__strong、__weak、__autoreleasing这四种属性
__unsafe_unretain、__strong、__weak、__autoreleasing是出现在 LLVM 编译器 3.0版本之后。
而__unsafe_unretain、__strong、__autorel...
分类:
其他好文 时间:
2015-04-25 18:29:29
阅读次数:
189
static int myTime = 30;
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIButton *btn;
@property (weak, nonatomic) ...
分类:
移动开发 时间:
2015-04-24 09:22:10
阅读次数:
230
ARC特点与判断准则/*
ARC的判断准则:只要没有强指针指向对象,就会释放对象
1.ARC特点
1> 不允许调用release、retain、retainCount
2> 允许重写dealloc,但是不允许调用[super dealloc]
3> @property的参数
* strong :成员变量是强指针(适用于OC对象类型)
* weak :成员变量是弱指针(适用于OC对象...
分类:
其他好文 时间:
2015-04-23 11:02:35
阅读次数:
162
readonly, readwrite:是控制属性的访问权限,readonly只生成getter方法,其他类是无法修改其值的。readwrite是会同时生成getter和setter方法,其他类可以修改其值。 assign, retain, weak, strong, copy,unsafe_...
分类:
其他好文 时间:
2015-04-16 23:52:57
阅读次数:
355