tableView背景设置

来源:互联网 发布:中国律师事务所 知乎 编辑:程序博客网 时间:2024/04/29 20:29

直接用tableview的backgroundColor属性赋图片,滑动时会重复。所以就用backgroundView。直接定义tableview背景视图

UIView* tempView=[[UIView alloc] initWithFrame:self.tableView.frame];     //创建一个覆盖tableview的view;

 tempView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"ground002.jpg"]];   //赋上view的背景图片
    self.tableView.backgroundView=tempView;     //设置backgroundView
0 0