sai*_*sai 6 iphone objective-c uitableview
如何禁用UserInteraction的UITableview细胞,但没有在该单元格的自定义按钮..
我正在创建一个按钮使用:
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];
Run Code Online (Sandbox Code Playgroud)
然后我就开始了
cell.userInteractionEnabled=NO;
Run Code Online (Sandbox Code Playgroud)
我该怎么dayButtonAction办?
Eng*_*epe 12
不要禁用用户与整个单元的交互.设置cell.selectionStyle = UITableViewCellSelectionStyleNone为阻止单元格选择.这样,用户仍然可以与按钮交互.
无法对userInteractionUITableView 应用禁用,而不能对UITableViewCell. 当启用时,您可以访问 UITableVie(它是 的子视图UITableView)的内容/控制器。当您添加任何控制器时, 实际上您添加了它,但单元格是其中的一部分,因此当您禁用它时,意味着它也为 UITableViewCell 设置它(否)。userInteractionUITabelViewUITableViewUITableViewCellUITableViewuserInteractionUITableView
在这里我也给你建议将你的UIButton单元格 添加为
[cell.contentView addSubView:buttonName];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6466 次 |
| 最近记录: |