数组对象深拷贝

2019-11-05  本文已影响0人  iOSTbag
aaa.jpg
- (id)copyWithZone:(nullable NSZone *)zone {
    GSKFleetManagementModel *model = [[GSKFleetManagementModel allocWithZone:zone]init];
    model.status = _status;
    model.statusArray = [self.statusArray copy];
    model.index = self.index;
    model.isId = [self.isId copy];
    model.current_status = [self.current_status copy];
    model.department = [self.department copy];
    model.location = [self.location copy];
    model.vehicle_make = [self.vehicle_make copy];
    model.vehicle_number = [self.vehicle_number copy];
    model.current_mileage = [self.current_mileage copy];
    model.workshop = [self.workshop copy];
    model.note = [self.note copy];
    model.score = [self.score copy];
    model.submited_at = [self.submited_at copy];
    model.reject_rich_info = [self.reject_rich_info copy];
    model.target_step = [self.target_step copy];

    return model;
}

- (id)mutableCopyWithZone:(NSZone *)zone {
    GSKFleetManagementModel *model = [[GSKFleetManagementModel allocWithZone:zone]init];
    model.status = _status;
    model.statusArray = [self.statusArray copy];
    model.index = self.index;
    model.isId = [self.isId copy];
    model.current_status = [self.current_status copy];
    model.department = [self.department copy];
    model.location = [self.location copy];
    model.vehicle_make = [self.vehicle_make copy];
    model.vehicle_number = [self.vehicle_number copy];
    model.current_mileage = [self.current_mileage copy];
    model.workshop = [self.workshop copy];
    model.note = [self.note copy];
    model.score = [self.score copy];
    model.submited_at = [self.submited_at copy];
    model.reject_rich_info = [self.reject_rich_info copy];
    model.target_step = [self.target_step copy];
    return model;
}

- (id)copyWithZone:(NSZone *)zone{
    GSKFeelManaRejectModel *model = [[GSKFeelManaRejectModel allocWithZone:zone] init];
    model.isSeleted = self.isSeleted;
    model.title = [self.title copy];
    model.reason = [self.reason copy];
    model.mudid = [self.mudid copy];
    model.at = [self.at copy];
    model.height = self.height;
    return model;
}

- (id)mutableCopyWithZone:(NSZone *)zone{
    GSKFeelManaRejectModel *model = [[GSKFeelManaRejectModel allocWithZone:zone] init];
    model.isSeleted = self.isSeleted;
    model.title = [self.title copy];
    model.reason = [self.reason copy];
    model.mudid = [self.mudid copy];
    model.at = [self.at copy];
    model.height = self.height;
    return model;

}

    NSArray *copyArr = [[NSArray alloc] initWithArray:self.dataArr copyItems:YES];
    self.model = copyArr[indexPath.row];

上一篇下一篇

猜你喜欢

热点阅读