美文网首页iOS开发精选Obj-C
iOS 解决零时变量的循环引用问题

iOS 解决零时变量的循环引用问题

作者: 韦德460 | 来源:发表于2017-05-04 14:20 被阅读38次
    • 问题代码
    UIView *coverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - self.btmBonusShareView.height)];
    [keyWindow addSubview:coverView];
    __weak typeof(self) weakSelf = self;
    [coverView setTapActionWithBlock:^{
        __strong typeof(self) pThis = weakSelf;
        [pThis removeBtmBonusShareViewAnimated:coverView];
    }];
    
    问题代码
    • 解决办法
    UIView *coverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - self.btmBonusShareView.height)];
    [keyWindow addSubview:coverView];
    __weak typeof(self) weakSelf = self;
    __strong UIView *tempView = coverView;
    [coverView setTapActionWithBlock:^{
        __strong typeof(self) pThis = weakSelf;
        [pThis removeBtmBonusShareViewAnimated: tempView];
    }];
    


    强烈推荐:超简单!!! iOS设置状态栏、导航栏按钮、标题、颜色、透明度,偏移等

    https://github.com/wangrui460/WRNavigationBar
    https://github.com/wangrui460/WRNavigationBar_swift



    欢迎关注我的微博:wangrui460

    相关文章

      网友评论

        本文标题:iOS 解决零时变量的循环引用问题

        本文链接:https://www.haomeiwen.com/subject/suortxtx.html