In ios7, UITableViewCellAccessoryDetailDisclosureButton is divided into two different accessory buttons

冷暖自知 提交于 2020-01-02 01:45:08

问题


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

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?


回答1:


mahboudz is correct in that the behaviours are now differentiated.

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.

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

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;
}

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




回答2:


This is the correct behavior. In iOS 7, you show both the "detail button" and the "disclosure indicator" using UITableViewCellAccessoryDetailDisclosureButton.

If you'd only like the "i" button, you'd use UITableViewCellAccessoryDetailButton and if you'd only like the "disclosure indicator, you'd use UITableViewCellAccessoryDisclosureIndicator.



来源:https://stackoverflow.com/questions/18740594/in-ios7-uitableviewcellaccessorydetaildisclosurebutton-is-divided-into-two-diff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!