用作自定义 UITableViewCell 的 XIB 中的自定义按钮不响应点击(ios7) [英] Custom buttons in XIB used as Custom UITableViewCell don't respond to taps (ios7)

查看:23
本文介绍了用作自定义 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆