#import <UIKit/UIKit.h> @interface EditCell : UITableViewCell @property (weak, nonatomic) IBOutlet UILabel *phone; @property (weak, nonatomic) IBOutlet UILabel *name; @property (weak, nonatomic) IBOutlet UIButton *checkBoxNil; @property (weak, nonatomic) IBOutlet UIButton *checkBoxSelected; @property (weak, nonatomic) IBOutlet UIButton *deletBtn; - (IBAction)checkBoxClicked:(id)sender; - (IBAction)deleBtnClicked:(id)sender; - (IBAction)checkBoxSelectedClicked:(id)sender; @property (nonatomic,copy) void(^checkBoxClickBlock)(void); @end #import "EditCell.h" @implementation EditCell - (void)awakeFromNib { // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (IBAction)checkBoxClicked:(id)sender { _checkBoxNil.hidden = YES; _checkBoxSelected.hidden = NO; _deletBtn.hidden = NO; } - (IBAction)deleBtnClicked:(id)sender { } - (IBAction)checkBoxSelectedClicked:(id)sender { _checkBoxNil.hidden = NO; _checkBoxSelected.hidden = YES; _deletBtn.hidden = YES; } @end |
|
40分 |
cell 是会重用的,选中的状态不能在cell 上保存,要保存到数据源里去,然后cell 根据数据来显示选中和非选中的样式
|
多谢! |