开发者

Remove corner shadow/offset in grouped UITableView

开发者 https://www.devze.com 2023-03-07 04:57 出处:网络
When a UITableView of type UITableViewStyleGrouped has a background view that is a non-default color or pattern image on the开发者_Go百科 iPad, the rounded corners have an ugly extra line, sort of lik

When a UITableView of type UITableViewStyleGrouped has a background view that is a non-default color or pattern image on the开发者_Go百科 iPad, the rounded corners have an ugly extra line, sort of like a bevel effect or drop shadow:

Remove corner shadow/offset in grouped UITableView

Does anyone know of any way to get rid of the extra line at the bottom of the table?


The default separator style for iPad is UITableViewCellSeparatorStyleSingleLineEtched. This is different from the iPhone's default of UITableViewCellSeparatorStyleSingleLine.

If you would like to remove the bevel, set the separatorStyle of the view to UITableViewCellSeparatorStyleSingleLine.

Note that the default separator style in iOS 5 for both devices is SingleLineEtched.


I had the same problem when using [UIColor scrollViewTexturedBackgroundColor]. I managed to remove the "bevel effect" / "drop shadow" by using the code below:

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;


I replaced the tableView's backgroundView with a new view.

I then relied on the tableView's backgroundColor property to set the color I wanted:

self.tableView.backgroundView = [[[UIView alloc] init] autorelease];
self.tableView.backgroundColor = [UIColor whiteColor];


Set the Content Inset of the bottom of your table view to something like -20 px. You may need to play around with the value.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号