Custom buttons in XIB used as Custom UITableViewCell don#39;t respond to taps (ios7)(用作自定义 UITableViewCell 的 XIB 中的自定义按钮不响应点击(ios7))
问题描述
所以我在这里将一个正常工作的 ios6 应用程序升级到 ios7,现在我无法在我的 tableviewcells 内的自定义按钮(或其他子视图)上接收点击或其他操作.
So here I am upgrading a working ios6 app to ios7, and now I can't receive taps or other actions on custom buttons (or other subviews) inside my tableviewcells.
我的代码:
这里是我部署 PlaceCell 的地方
Here is where I deploy my PlaceCell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"PlaceCell";
PlaceCell *cell = [tableView dequeueReusableCellWithIdentifier: cellIdentifier];
if (!cell) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"PlaceCell" owner:self options:nil];
cell = [nib lastObject];
cell.reuseIdentifier = cellIdentifier;
}
[cell configureCellWithPlace: [self.places objectAtIndex:indexPath.row]];
cell.delegate = self;
cell.userInteractionEnabled = YES;
return cell;
}
然后它是一个带有按钮的普通自定义单元格,这些按钮通过界面连接到一些操作.它在 iOS6 上完美运行,但在 iOS7 上没有任何作用.
And then it is a normal custom cell with buttons which are connected to some actions by the interface. It works perfectly with iOS6, but it does nothing with iOS7.
感谢您的帮助.
推荐答案
已解决:
[cell.contentView setUserInteractionEnabled: NO];
这篇关于用作自定义 UITableViewCell 的 XIB 中的自定义按钮不响应点击(ios7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用作自定义 UITableViewCell 的 XIB 中的自定义按钮不响应点击(ios7)


- UITextView 内容插图 2022-01-01
- URL编码Swift iOS 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01