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];
        }
    }];
原文地址:https://www.cnblogs.com/qiyiyifan/p/8602358.html