本文介绍了在ios7中,UITableViewCellAccessoryDe​​tailDisclosureButton分为两个不同的附件按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

复选标记表示当时选定的行,左图像是iOS7模拟器,右图是iOS6模拟器。

Check mark represents the selected row at that time, left image is of iOS7 simulator and right is of iOS6 simulator.

问题是 iOS7中的UITableViewCellAccessoryDe​​tailDisclosureButton有两个部分,一部分带有右箭头附件,另一部分是可点击的i按钮而不是iOS6。
这是标准行为还是我做错了,如果它是标准的那么在iOS7中处理UITableViewCellAccessoryDe​​tailDisclosureButton的正确方法应该是什么?

The concern is UITableViewCellAccessoryDetailDisclosureButton in iOS7 has two parts, one part with right arrow accessory and other is the clickable "i" button rather than iOS6.Is it a standard behaviour or am I doing something wrong, if it is standard then what should be the correct way of handling UITableViewCellAccessoryDetailDisclosureButton in iOS7?

推荐答案

mahboudz是正确的,因为行为现在已经区分了。

mahboudz is correct in that the behaviours are now differentiated.

如果你只设置了DetailButton然后在iOS7中你会看到(i)作为可敲击的配件按钮。但在iOS6中你什么都看不到。因此,使用SDK7.0使用 accessoryButtonTappedForRowWithIndexPath 弹出详细信息视图不适用于iOS6设备,因为没有附件显示。

If you set only the DetailButton then in iOS7 you will see the (i) as a tap-able accessory button. But in iOS6 you won't see anything. So popping a detail view using accessoryButtonTappedForRowWithIndexPath using SDK7.0 doesn't work on an iOS6 device as no accessory gets displayed.

使用反向配置有类似的问题,但你会使用 didSelectRowAtIndexPath

Using the reverse config has similar issues, but you would be using didSelectRowAtIndexPath instead.

解决方法我发现在iOS7中应用类似的方法来处理extendedLayouts。

The work around I found was to apply a similar approach to the dealing with the extendedLayouts in iOS7.

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

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

So in iOS7 I use the DetailButton only and in pre-iOS7 versions I use the DetailDiscloureButton.

这篇关于在ios7中,UITableViewCellAccessoryDe​​tailDisclosureButton分为两个不同的附件按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 04:59