禁用时出现问题触摸UITableview时显示选择? [英] a problem when disable Show selection on touch of UITableview?

查看:106
本文介绍了禁用时出现问题触摸UITableview时显示选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用IB并取消选中在触摸时显示选择,但它仍会在所选的单元格上显示蓝色突出显示。这是苹果的错误还是我得错了。

I use IB and uncheck the 'Show selection on touch' but it still show blue highlight on cell that is selected. Is this a bug with apple or I am getting something wrong.

推荐答案

这可能是IB中的一个错误,正如您在文档中看到的那样该表视图没有任何触摸显示选项的属性。它是tableview cell的属性。所以复选框不应出现在IB中。可能你可以用苹果提出一个错误并看看他们对此有何看法。

This is probably a bug in IB as you see in Documentation that table view does not have any property for the shows Selection on touch. It is the property of tableview cell rather. So the checkbox should not be present in the IB. Probably you can file a bug with apple and see what they say about it.

为了获得效果,你应该这样做:

For getting the effect you should do it like:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

            cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
            if (cell == nil) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier2];
                [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
            }
    }

希望这有帮助。

这篇关于禁用时出现问题触摸UITableview时显示选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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