UITableViewController背景图片 [英] UITableViewController Background Image

查看:107
本文介绍了UITableViewController背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为UITableViewController设置图像?

我已经使用了很多东西,但是将图像设置为背景并没有帮助

I have used many things but it doesn't help me to set the image as background

UIImageView* bgView = [[[UIImageView alloc] initWithImage:
[UIImage imageNamed:@"Default.png"]] autorelease];

[tableView.backgroundView addSubview:bgView];

还有这个

[[self view] setAutoresizesSubviews:NO];

UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.frame];
backgroundView.backgroundColor = 
  [UIColor colorWithPatternImage:
    [UIImage imageNamed:@"Default.png"]];

self.tableView.backgroundView = backgroundView;
self.tableView.backgroundColor = [UIColor clearColor];

[backgroundView release];

self.navigationController.view.backgroundColor = 
  [UIColor colorWithPatternImage:
    [UIImage imageNamed:@"myImage.png"]];
self.tableView.backgroundColor = [UIColor clearColor];

没有一个对我有用.

推荐答案

设置background填充模式

[youTable setBackgroundView:
  [[UIImageView alloc] initWithImage:
    [UIImage imageNamed:@"bg.png"]]];

设置background模式图块

[youTable setBackgroundColor:
  [UIColor colorWithPatternImage:
    [UIImage imageNamed:@"bg.png"]]];

这篇关于UITableViewController背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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