【问题标题】:In ios7, UITableViewCellAccessoryDetailDisclosureButton is divided into two different accessory buttons在ios 7中,UITableViewCell Accessory DetailDisclosureButton分为两个不同的附件按钮
【发布时间】:2013-09-11 11:59:31
【问题描述】:

勾号代表当时选中的行,左图是iOS7模拟器,右图是iOS6模拟器。

关注的是UITableViewCellAccessoryDetailDisclosureButton in iOS7 has two parts, one part with right arrow accessory and other is the clickable "i" button rather than iOS6. 这是标准行为还是我做错了什么,如果它是标准的,那么在 iOS7 中处理 UITableViewCellAccessoryDe​​tailDisclosureButton 的正确方法应该是什么?

【问题讨论】:

  • 注意 ios7 的宽度比 ios6 大,在运行时检查两者,看看你得到了什么。
  • 显示一些关于如何配置/布置单元格内容的代码。

标签: ios ios7 uitableview


【解决方案1】:

mahboudz 是正确的,因为现在行为已经不同了。

如果您只设置了 DetailButton,那么在 iOS7 中,您将看到 (i) 作为可点击的附件按钮。但是在 iOS6 中你什么都看不到。因此,使用 SDK7.0 使用 accessoryButtonTappedForRowWithIndexPath 弹出详细视图在 iOS6 设备上不起作用,因为没有显示任何附件。

使用反向配置有类似的问题,但您将使用 didSelectRowAtIndexPath 代替。

我发现的解决方法是应用类似的方法来处理 iOS7 中的扩展布局。

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
    cell.accessoryType =  UITableViewCellAccessoryDetailButton;
} else {
    cell.accessoryType =  UITableViewCellAccessoryDetailDisclosureButton;
}

所以在 iOS7 中我只使用 DetailButton,在 iOS7 之前的版本中我使用DetailDiscloureButton

【讨论】:

    【解决方案2】:

    这是正确的行为。在 iOS 7 中,您使用 UITableViewCellAccessoryDetailDisclosureButton 同时显示“详细信息按钮”和“披露指示器”。

    如果您只喜欢“i”按钮,您可以使用UITableViewCellAccessoryDetailButton,如果您只喜欢“披露指示器”,您可以使用UITableViewCellAccessoryDisclosureIndicator

    【讨论】:

    • 没有那么简单。 UITableViewCellAccessoryDe​​tailButton 不像 UITableViewCellAccessoryDe​​tailDisclosureButton 那样跟踪你的手指。
    猜你喜欢
    • 1970-01-01
    • 2011-12-17
    • 2013-09-21
    • 1970-01-01
    • 1970-01-01
    • 2018-10-01
    • 2010-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多