自定义背景uitableview超过1个部分(IPHONE) [英] custom background uitableview with more than 1 section (IPHONE)

查看:133
本文介绍了自定义背景uitableview超过1个部分(IPHONE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将图像设置为我的UITableViewController;如果我在tableview上只有一个部分它可以正常工作:

I need to set an image to my UITableViewController; if i have just one section on the tableview it works fine with:

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"someImage.jpeg"]];

但是如果有2个部分,则每个部分的图像都会重复。

but if there are 2 section the image comes duplicate for each section.

推荐答案

不要使用图案图像。使用tableView的 backgroundView 属性:

Don't use a pattern image. Use the tableView's backgroundView property:

UIImageView * background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"someImage.jpeg"]];
[[self tableView] setBackgroundView:background];
[background release];

这篇关于自定义背景uitableview超过1个部分(IPHONE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆