美文网首页
关于strongly in this block is like

关于strongly in this block is like

作者: 行走的风车 | 来源:发表于2016-08-01 14:16 被阅读52次
    //避免block中变量被循环引用
     __block MakeOrderViewController *blockSelf = self;
    chvc.calendarblock = ^(CalendarDayModel *model){   
        NSLog(@"%@",[model toString]);
        if(model.style==CellDayTypeClick)
        {
            [blockSelf->dataArray addObject:model.toString];
            
            NSSet *set = [NSSet setWithArray:blockSelf->dataArray];
            dataArray=[[set allObjects] mutableCopy];
            
            [blockSelf->dataArray sortUsingComparator:^NSComparisonResult(NSNumber *obj1, NSNumber *obj2) {
                return [obj1 compare:obj2];
            }];
        }
        else
        {
            [blockSelf->dataArray removeObject:model.toString];
        }
    };

    相关文章

      网友评论

          本文标题:关于strongly in this block is like

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