UITableView背景色iOS 9

前端之家收集整理的这篇文章主要介绍了UITableView背景色iOS 9前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个UITableView,我想将其背景颜色设置为透明.表视图的背景颜色和界面构建器的所有子视图都设置为透明.它适用于iOS 8& 7.但是,不是iOS 9.任何想法?

cellForRowAtIndexPath方法

  1. [cell setSelectedBackgroundView:[[UIView alloc] init]];
  2. [cell.selectedBackgroundView setBackgroundColor:[UIColor clearColor]];
  3. [cell setBackgroundColor:[UIColor clearColor]];
  4. [cell.contentView setBackgroundColor:[UIColor clearColor]];
  5. [cell setBackgroundView:[[UIView alloc] init]];
  6. [cell.backgroundView setBackgroundColor:[UIColor clearColor]];

解决方法

Objective-C的:
  1. [self.yourTableView setBackgroundColor:[UIColor clearColor]];

迅速:

  1. self.yourTableView.backgroundColor = .clear

XCode 7.0错误.没有从Storyboard中获取

猜你在找的iOS相关文章