怎麼禁用UITableView
單元的UserInteraction
,但不是單元中的自定義按鈕。
創建按鈕:
UIButton *dayButton = [UIButton buttonWithType:UIButtonTypeCustom];
[dayButton setFrame:CGRectMake(201, 0, 30, 35)];
[dayButton addTarget:self action:@selector(selectDayView) forControlEvents:UIControlEventTouchUpInside];
[dayButton setBackgroundImage:[UIImage imageNamed:@"86-camera.png"] forState:UIControlStateNormal];
dayButton.userInteractionEnabled=YES;
[cell addSubview:dayButton];
然後設置了:
cell.userInteractionEnabled=NO;
怎麼獲取dayButtonAction?
嘗試設置
cell.selectionStyle=UITableViewCellSelectionStyleNone;
響應動作
[dayButton addTarget:self action:@selector(selectDayView:) forControlEvents:UIControlEventTouchUpInside];
-(void)selectDayView:(id)sender {
/////to do ....
}