tableview的重用
这是主要的代码:
在cellForRowAtIndexPath中,
[cell.selectContactsBtn setBackgroundImage:[UIImage imageNamed:@"u371_normal.png"] forState:UIControlStateSelected];
cell.selectContactsBtn.tag = indexPath.row;
[cell.selectContactsBtn addTarget:self
action:@selector(addSelectContactsView:)
forControlEvents:UIControlEventTouchUpInside];
- (void)addSelectContactsView:(id)sender {
NSLog(@"%d",[sender tag]);
UIButton *selectContactsButton = (UIButton *)sender;
selectContactsButton.selected = !selectContactsButton.selected;
selectContactsView.frame = CGRectMake(0, 20, 320, 44);
[self.view addSubview:selectContactsView];
}