开发者

Black corners around UITableViewCells

I am trying to display a UITableView in front of an image, and here's the steps I'm following:

  • Inside the view, ad开发者_如何学编程d a UIImageView with the image set to the appropriate file in the project
  • Add a UITableView inside the parent view (the same parent as the image view)
  • Set the backgroundColor for the table view to clear
  • Wire up a datasource in the view controller to display some test data
  • Hook up the data source in IB.

After doing this, the tableviewcells have a black background in the corners. It isn't coming from any of the parent views as far as I can tell. I have a test project at bitbucket which demonstrates the issue.


Jeff Lamarche ran into the exact same issue today and put up a blog post about it: http://iphonedevelopment.blogspot.com/2010/08/transparent-grouped-tableviews.html

Basically, there appears to be some bug where you still need to add this in code (even though you already have the tableView set to be clear in Interface Builder):

self.tableView.backgroundColor = [UIColor clearColor];


To remove the black edges just go to ur .m file and in ur viewDidLoad method add a line

tableName.backgroundColor = [UIColor clearColor];

and thats it no more ugly UI


As stated in Jawboxer's answer, you need to set the background colour in code:

self.tableView.backgroundColor = [UIColor clearColor];

But also ensure that the background colour in Interface Builder is set to the default "Group Table View Background Color". I had it as "Clear Color" in IB and it still wasn't working, until I reset it to the default.


The root cause of why you must set the clear color in code is here: Black corners on UITableView Group Style

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜