我有一个UITableView,我想将其背景颜色设置为透明.表视图的背景颜色和界面构建器的所有子视图都设置为透明.它适用于iOS 8& 7.但是,不是iOS 9.任何想法?
cellForRowAtIndexPath方法:
[cell setSelectedBackgroundView:[[UIView alloc] init]]; [cell.selectedBackgroundView setBackgroundColor:[UIColor clearColor]]; [cell setBackgroundColor:[UIColor clearColor]]; [cell.contentView setBackgroundColor:[UIColor clearColor]]; [cell setBackgroundView:[[UIView alloc] init]]; [cell.backgroundView setBackgroundColor:[UIColor clearColor]];
解决方法
Objective-C的:
[self.yourTableView setBackgroundColor:[UIColor clearColor]];
迅速:
self.yourTableView.backgroundColor = .clear
XCode 7.0错误.没有从Storyboard中获取