IOS7 UITableView在Settings App中分组 [英] IOS7 UITableView grouped like in Settings App
问题描述
在IOS7中,当使用style = grouped时,UITableView不再有缩进。如何启用缩进,以便UITableView的行为类似于来自apple的设置应用程序?
In IOS7 the UITableView does not have indentation anymore when using style=grouped. How can enable the indentation, so that the UITableView behaves like the settings app from apple?
推荐答案
有一种更简单的方法可以实现这一点。
There is a much simpler way to achieve this.
-
将UITableView放在两侧。例如:使用Autolayout,你有一个15px的前导和尾随空格(或任何你想要的)。 你现在正在创建苹果过去通过分组表视图免费提供的缩进。
调整图层添加角落和边框。
Adjust the layer to add corners and a border.
[[[self tableView] layer] setCornerRadius:5.0f];
[[[table tableView] layer] setBorderWidth:0.5f];
[[[table tableView] layer] setBorderColor:[[UIColor redColor ] CGColor]];
(我无法发布结果图片,因为我还没有足够的声誉)
(I can't post an image of the result because I don't yet have enough reputation)
这篇关于IOS7 UITableView在Settings App中分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!