Swift weakSelf写法
2016-07-26 16:41
363 查看
类:AVC
#import <UIKit/UIKit.h>
typedef void(^ABlock)(void);
@interface AVC :
UIViewController
@property (nonatomic,copy)
ABlock aBlock;
@end
引用类:
@IBAction
func btnClick(sender:
AnyObject) {
let vc:AVC =
AVC()
vc.aBlock = ({[weak
self] in
let vc0:AVC =
AVC()
self!.navigationController?.pushViewController(vc0, animated:
true)
})
self.navigationController?.pushViewController(vc, animated:
true)
}
#import <UIKit/UIKit.h>
typedef void(^ABlock)(void);
@interface AVC :
UIViewController
@property (nonatomic,copy)
ABlock aBlock;
@end
引用类:
@IBAction
func btnClick(sender:
AnyObject) {
let vc:AVC =
AVC()
vc.aBlock = ({[weak
self] in
let vc0:AVC =
AVC()
self!.navigationController?.pushViewController(vc0, animated:
true)
})
self.navigationController?.pushViewController(vc, animated:
true)
}
相关文章推荐
- swift - UIScrollView 的使用
- Xcode 8 beta iOS10 swift还是有这个错误提示
- 01-swift微博初始化项目
- swift使用cocoapods导入oc三方库
- Swift基础(二十三)UIImageView
- Swift 字符串数字下标索引字符
- Swift的Optional、Array
- Swift - 点击状态栏使tableView返回顶部(附:状态栏点击事件响应)
- Swift基础(二十二)UIAlertView,UIActionSheet,UIAlertController
- 闭包
- 函数的定义和用处
- 集合(数组,字典)
- 字符串
- 循环语句
- 控制流-(判断语句)
- Swift基本语法 - let/var
- Swift开发UITableView常用的一些细节知识点介绍
- Swift开发UITableView常用的一些细节知识点介绍
- swift实现简单的图文混排
- swift - UIStepper的用法