iOS block第二弹

对于多重block防止重复引用的方法

 

  __weak typeof(self) weakSelf = self;

[_moreActionSheet showFNActionSheetWithCompletionHandler:^(NSInteger buttonIndex) {
       if (buttonIndex == 1) {
            //发送消息
            [FNAlertHelper showAlertWithTitle:item.content msg:@"" chooseBlock:^(NSInteger buttonIdx) {
                __strong typeof(weakSelf) strongSelf = weakSelf;
                if (buttonIdx == 1) {
                    [strongSelf showMessageView:[NSArray arrayWithObjects:item.content, nil] title:@"" body:@""];
                }
            } buttonsStatement:@"取消", @"发短信", nil];
            
        } else if (buttonIndex == 2) {
            // 复制
            UIPasteboard *pboard = [UIPasteboard generalPasteboard];
            pboard.string = item.content;
            [weakSelf.view makeToast:@"复制成功" duration:2 position:CSToastPositionCenter];
        }
    }];

 

posted on 2018-03-19 15:13  麦芽呀~  阅读(124)  评论(0编辑  收藏  举报