ios开发解决遍历删除数组对象报错
// 删除对应数据
// for (OrderModel *order in self.OrderList) {
//
// NSLog(@"%ld----%ld",order.tagBut,(long)btn.tag);
//
// if (order.tagBut==btn.tag) {
//
//// [self.OrderList removeObjectAtIndex:btn.tag];
//
// [self.OrderList removeObject:order];
//
//// [self.orderview.paytableview reloadData];
//
// }
//
// if (self.OrderList.count==0) {
//
// self.commitBtn.hidden= YES;
//
// }
// }
//
for(int i=0; i < [self.OrderList count]; i++){
OrderModel *order = [self.OrderList objectAtIndex:i];
if (order.tagBut==btn.tag) {
[self.OrderList removeObject:order];
i--;
}
if (self.OrderList.count==0) {
self.commitBtn.hidden= YES;
}
}