`
wfkbyni
  • 浏览: 85088 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

weakSelf

阅读更多

快速的定义一个weakSelf 当然是用于block里面啦

#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;
分享到:
评论

相关推荐

    iOS开发技巧之WeakSelf宏的进化详解

    本文主要给大家介绍了关于iOS之WeakSelf宏的进化的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧。 WeakSelf宏的进化 我们都知道在防止如block的循环引用时,会使用__weak关键字做如下...

    一篇文章让你看懂IOS中的block为何再也不需要WeakSelf弱引用

    主要给大家介绍了关于IOS中block为何再也不需要WeakSelf弱引用的相关资料,文中通过示例代码介绍的非常详细,对各位iOS开发者们具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧。

    ios-DLCalender.zip

    __weak typeof(self)weakSelf=self; _calendarView.calendarBlock = ^(NSInteger day, NSInteger month, NSInteger year){ NSString *dateString=[NSString stringWithFormat:@"%lu-%lu-%lu",year,month,day...

    iOS 获取系统通讯录的名字和电话【第二版】

    __weak typeof(self)weakSelf = self; //iOS >=iOS9 _objct10 = [[RXAddressiOS10 alloc] init]; _objct10.complete = ^(BOOL status, NSString * phoneNum, NSString * nameString) { if(status) { weakSelf...

    ios-datePickerView.zip

    __weak NextViewController * weakself=self; self.datePicker =[[[NSBundle mainBundle] loadNibNamed:@"DatePickerView" owner:self options:0] lastObject]; self.datePicker.frame =CGRectMake(0, self....

    ios-Swift TableView及上下拉刷新封装.zip

    weak var weakSelf = self // 弱引用 weakSelf!.register(type: .Class, name: "UITableViewCell") // 注册cell ID默认是传出的name ID 3.设置相关属性 weakSelf!.setTableView(isAllRefresh: true, type: .Default,...

    ios-封装UITableView下拉和上拉.zip

    __weak typeof(self)weakSelf = self; [self.tableView setLoadingBlock:^(BOOL pullDown) { [weakSelf requestData:!pullDown]; }]; //4.发起你的数据请求 //5.结束动画 [self.tableView reloadData]...

    ios-tableView实现三级地市.zip

    代码简洁,几句话就可以实现。... weakSelf.valueLab.text = [NSString stringWithFormat:@"%@-%@-%@-%@", provice, city, area, code]; }; [self presentViewController:alertVc animated:YES completion:nil];

    ios-MGXWebBridge.zip

    __weak typeof(self) weakSelf = self; self.bridge.JSHander = ^id(NSString * _Nonnull funcName, NSArray * _Nonnull params) { NSLog(@"%@===%@",funcName,params); if ([funcName isEqualToString:@...

    ios-仿qq未读消息的拖拽效果.zip

    __weak typeof(self) weakSelf = self; self.bubbleView.cleanMessageBlock = ^(BOOL isClean) { if (isClean) { weakSelf.messageSteper.value = 0; } else { // do other logical operation } }; 当...

    基于Object-C实现的列表选择课程作业项目.zip

    用法一 NSArray *optionList = @[@"北京", @"天津", @"山西", @"河北"]; NBLPickerView *pickerView = ...__weak typeof(self) weakSelf = self; pickerView.blockClickLeftButton = ^BOOL(NSInteger inde

    IOS设置页面的封装ZFSetting.zip

    初始化Item:__weak typeof(self) weakSelf = self; // 初始化Item ZFSettingItem *help = [ZFSettingItem itemWithIcon:@"MoreHelp" title:@"帮助" type:ZFSettingItemTypeArrow]; //cell点击事件的block...

    Reachability—Master

    支持同步和异步的网络监听 self.blockLabel.text = @"Not Fired Yet"; self.notificationLabel.text = @"Not Fired Yet"; self.localWifiblockLabel.text = @"Not... __weak __block typeof(self) weakself = self;

    ios-图片浏览器.zip

    [weakSelf.collectionView addSubview:showView]; showView.backgroundColor = [UIColor blackColor]; //消失回调 [showView setDismissBlock:^{ self.tabBarController.tabBar.hidden = NO; self....

    MSCustomOperation

    UIButton块 特征 块语法 安装 Cocoapods(推荐) 将pod 'MSDeallocCallBack'添加到您的Podfile中。 运行pod install 手动的 将MSDeallocCallback下的所有文件添加到您的... NSLog ( @" xxxx %@ " ,weakSelf. sc );

    MSDeallocCallback

    UIButton块 特征 块语法 安装 Cocoapods(推荐) 将pod 'MSDeallocCallBack'添加到您的Podfile中。 运行pod install 手动的 将MSDeallocCallback下的所有文件添加到您的... NSLog ( @" xxxx %@ " ,weakSelf. sc );

    SHRACComparison:比较基于块的 Foundation 和 UIKit 的东西与 RAC 的实现——为了科学

    #####第一个样本 __weak typeof (self) weakSelf = self; [ self SH_addObserverForKeyPaths: @[ @" username " ] withOptions: kNilOptions block: ^(__unused NSString *keyPath, __unused NSDictionary *change) ...

Global site tag (gtag.js) - Google Analytics