@interface CustomButton : UIButton @property (nonatomic,assign)NSInteger indexPathRow; @end
#pragma mark - selectedBtnAction
-(void)selectedBtnAction:(CustomButton *)btn
{
btn.selected=!btn.selected;
[self.delegate GoodsCellDelegateWithIndexPath:btn.indexPathRow];
}
-(void)configWithModel:(GoodsModel *)model{
self.model = model;
if (model.btnIsSelected==YES) {
[self.selectedBtn setImage:[UIImage imageNamed:@"sendcar_selected"] forState:UIControlStateNormal];
}else{
[self.selectedBtn setImage:[UIImage imageNamed:@"sendcar_unselected"] forState:UIControlStateNormal];
}
//运单号
self.cardLabel.text = [NSString stringWithFormat:@"运单号:%@",self.model.Ticket_No];
}
#pragma mark - delegate
-(void)GoodsCellDelegateWithIndexPath:(NSInteger)indexPathRow
{
GoodsModel *cacheModel = self.dataArr[indexPathRow];
if (cacheModel.btnIsSelected) {
// NSLog(@"YES==%@",cacheModel.Ticket_No);
cacheModel.btnIsSelected = NO;
} else {
// NSLog(@"NO==%@",cacheModel.Ticket_No);
cacheModel.btnIsSelected = YES;
}
//插入---删除 反复切换
[self.dataManager insertDataFromModel:cacheModel Ticket_No:cacheModel.Ticket_No];
//每次执行插入删除操作就会刷新底部的车辆的按钮
[self reloadBottonViewUI];
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:indexPathRow inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
}
#pragma mark - 刷新底部的选车的数量 reloadBottonViewUI
-(void)reloadBottonViewUI
{
if ([self.dataManager getAllGoodsArrCount]>0) {
[self.toSelectCarBtn setTitle:[NSString stringWithFormat:@"去发车(%ld)",(long)[self.dataManager getAllGoodsArrCount]] forState:UIControlStateNormal];
}else{
[self.toSelectCarBtn setTitle:@"去发车" forState:UIControlStateNormal];
}
}
#pragma mark - 去选车
-(void)toSelectCarBtnAction
{
if ([self.dataManager getAllGoodsArrCount]>0) {
//do something
[self showSingleAlertViewWith:self title:@"提示" message:@"do something"];
}else{
[self showSingleAlertViewWith:self title:@"提示" message:@"请选择物品"];
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有