@interface VipMoneyViewController ()<UITableViewDelegate,UITableViewDataSource,UIWebViewDelegate>{
UIButton *_preBtn;
}
@property (assign, nonatomic) NSInteger selectRow;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//價格列表
VipChargeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellTwo"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
VipModel *model = self.arrayModel[indexPath.row - 1];
cell.monLabel.text = model.months;
cell.moneyLabel.text = model.price;
// [cell setModel:model];
// self.selectRow = indexPath.row;
//判斷點擊選擇圖形
if (indexPath.row == 1) {
_preBtn = cell.chooseBtn;
}
cell.chooseBtn.tag = indexPath.row;
if (indexPath.row == _selectRow) {
if(_selectRow == 1){
[cell.chooseBtn setBackgroundImage:[UIImage imageNamed:@"icon_choose_go"]forState:UIControlStateNormal];
VipModel *model = self.arrayModel[indexPath.row-1 ];
self.vip_id = model.vip_id;
}else{
[cell.chooseBtn setBackgroundImage:[UIImage imageNamed:@"icon_choose_go"]forState:UIControlStateNormal];
}
}else{
[cell.chooseBtn setBackgroundImage:[UIImage imageNamed:@"icon_choose_normal"]forState:UIControlStateNormal];
}
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0||indexPath.row > 3) {
return;
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
self.selectRow = indexPath.row;
VipModel *model = self.arrayModel[indexPath.row - 1];
self.vip_id = model.vip_id;
UIButton *btnSelect = [self.view viewWithTag:indexPath.row];
[btnSelect setBackgroundImage:[UIImage imageNamed:@"icon_choose_go"] forState:UIControlStateNormal];
if (_preBtn) {
[_preBtn setBackgroundImage:[UIImage imageNamed:@"icon_choose_normal"] forState:UIControlStateNormal];
}
_preBtn = btnSelect;
// [tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone]; //放棄自動刷新
}