[英]UITableView grouped background image
我正在設置UITableView
分組圖像,但是它顯示了整個表,我希望它在第二張表的下面,應該只在背景圖像中顯示單元格和表格的區域,而不是第二張表中的灰色邊框。
使用以下代碼。
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]];
有關為分組的UITableView
設置背景圖像的另一種方法,請閱讀本文檔。
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBackground.png"]];
[tempImageView setFrame:self.tableView.frame];
self.tableView.backgroundView = tempImageView;
[tempImageView release];
而不是將背景圖像提供給表格,而是將背景圖像/顏色提供給單元格。
cell.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]];
since colorWithPattern is very expensive which causes memory leak,avoid using colorWithPatternImage
instead you can use
cell.backgroundColor=[UIColor initWithRed:0.25 green:0.25 blue:0.25 alpha:1];
//change the RGB as per the image
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.