经常遇到要给tableView设置背景图片的问题,但如果直接设置背景  backgroundView的话,背景图不会显示,原因是  tableView上的cell默认是不透明的颜色,所以解决方法是 让  cell透明即可:

1.给tableView设置背景view 
  UIImageView *backImageView=[[UIImageViewalloc]initWithFrame:self.view.bounds]; 
   [backImageView setImage:[UIImageimageNamed:@"liaotianbeijing"]]; 
    self.tableView.backgroundView=backImageView; 
   
2.让cell透明 
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
       
    
   MyCell  *cell = [tableViewdequeueReusableCellWithIdentifier:@"METext"forIndexPath:indexPath]; 
    cell.backgroundColor=[UIColor clearColor];//关键语句 
    [cell setCellInfo:dic];//自定义类目方法 
     return cell; 
       
}

给tableView设置背景图片的更多相关文章

  1. img只显示图片一部分 或 css设置背景图片只显示图片指定区域

    17:14 2016/3/22img只显示图片一部分 或 css设置背景图片只显示图片指定区域 background-position: 100% 56%; 设置背景图片显示图片的哪个坐标区域,图片左 ...

  2. 为窗体设置背景图片-UI界面编辑器(SkinStudio)教程

    1.1.   为窗体设置背景图片 在窗体的Background属性中选择图片设置为窗体背景图片

  3. UIView 设置背景图片

    http://blog.csdn.net/qijianli/article/details/7777268 项目中,可能需要我们为某个视图设置背景图片,而API中UIView没有设置背景图片的方法,那 ...

  4. tr设置背景图片

    tr是不能设置背景图片的....

  5. [Netbeans]为面板设置背景图片

    与AndroidStudio等类似IDE不同,在Netbeans开发桌面程序时,不可以直接通过src=@drawable 等方法为窗口设置背景图片.这里介绍一种简便的方法: 1:首先,拖动一个面板到f ...

  6. background-size 设置背景图片的大小

    background-size 设置背景图片的大小,以长度值或百分比显示,还可以通过cover和contain来对图片进行伸缩. 语法: background-size: auto | <长度值 ...

  7. qt 设置背景图片

    博客出处:http://www.cppblog.com/qianqian/archive/2010/07/25/121238.htm 工作似乎走上正轨了,上周五的工作是做一个界面,用到QFrame和Q ...

  8. Android代码中设置背景图片

    //设置背景图片        String picfile= Environment.getExternalStorageDirectory() + "/pdp/pdp.png" ...

  9. Win7无法设置背景图片的快速解决办法

    不知道怎么回事,win7电脑突然连个性化设置背景图片的按钮都没了.真操蛋~~~满屏的黑色背景图案,看着实在是不爽. 为了解决这个问题,网上搜索了好长时间,都不尽然! 最后想到了一个超简单的方法就是: ...

随机推荐

  1. icon moon追加字体

    一.初始自定义字体为icon moon1@font-face { font-family: 'icomoon1'; src: url('fonts/icomoon1.eot?9fhn24'); src ...

  2. mongoose的关联查询 :populate

    mongoose关联查询从3.2版本开始支持 基本用法如下: var studentSchema = new Schema({ name:String, age:String, school:{ ty ...

  3. 【IDEA&&Eclipse】1、为何 IntelliJ IDEA 比 Eclipse 更适合于专业java开发者

    圣战 有一些没有唯一正确答案的“永恒”的问题,例如哪个更好:是Windows还是Linux,Java还是C#:谁更强壮:Chuck Norris还是Van Damme. 其中的一个圣战便是Java I ...

  4. drf的组件和解析器

    drf的序列化组件: 1. 用途: 把python中的对象,转成json格式字符串 2. 使用步骤1: 写一个类继承Serializer或者ModelSerializer 举例(类中选取字段进行序列化 ...

  5. Linux下初次使用github

    1.安装 1.1 使用yum安装的 命令:$ yum install git git-gui 1.2 生成密钥对,使用ssh-keygen方法 ssh-keygen -t [rsa|dsa],将会生成 ...

  6. Parsing Natural Scenes and Natural Language with Recursive Neural Networks-paper

    Parsing Natural Scenes and Natural Language with Recursive Neural Networks作者信息: Richard Socher richa ...

  7. js中this是什么?

    this是js的一个关键字 指定一个对象然后去替代他 分两种情况函数内的this和函数外的this 函数内的this指向行为发生的主体 函数外的this都指向window函数内的this跟函数在哪定义 ...

  8. SQL-记录删除篇-007

    删除记录: delete * from table_name 解释:删除表中的所有数据 delete * from table_name where id<10 解释:删除表中id小于10的数据 ...

  9. centos下配置maven编译环境

    版本centos6jdk1.7findbugs-3.0.1maven-3.0.5protobuf-2.6.0安装yum install lzo-devel zlib-devel gcc gcc-c++ ...

  10. PHP发送POST请求

    方式一:cURL $url = "localhost/test/post/service.php"; $data = array("a"=>"网 ...