Eyes, JAPAN Blog > How to set UITableView without background

How to set UITableView without background

will

この記事は1年以上前に書かれたもので、内容が古い可能性がありますのでご注意ください。

Usually, iOS developers were passed by well designed UIs. To make the view fixed the design, we usually  set the background of some component as transparents. Some days ago , I faced a problem to set the background of UITableView, however, I tried long time to make the UITableView with the same background as the parent view.

At the beginning, I set the background color of the table view with clear color, but it didnt work.

[tView setBackgroundColor:[UIColor clearColor]];

Finally, I found that there is a default background view in the table view, so I set it nil in the viewDidLoad function, then it worked.

[tView setBackgroundView:nil];
 Then I set the cell with custom background view in the cellForRowAtIndexPath method.
UIImageView *cellBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img_tablecell_bg.png"]];
[cell setBackgroundView:cellBackgroundView];</pre>
[cell setBackgroundColor:[UIColor clearColor]];

Reference:
  • このエントリーをはてなブックマークに追加

Comments are closed.