如何用图片替换 UITableView? [英] How To Replace UITableView With Image?

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

问题描述

在用户编辑并向其添加数据之前,我有一个默认为空白的 UITableView.我想显示一个带有说明的图像,直到用户编辑它.

I have a UITableView that is blank be default until the user edits and adds data to it. I want to show an image with instructions that is shown until the user edits it.

图片的大小非常适合导航栏和标签栏之间.

The size of the picture is so it fits under perfectly between the nav bar and the tab bar.

有没有办法以编程方式做到这一点?

Is there a way to do this programmatically?

推荐答案

你可以使用 removeFromSuperview 从超级视图中移除 UITableView 然后添加你的 UIImageView.

you can use removeFromSuperview to remove UITableView from super view then add your UIImageView.

使用下面的代码:

-(void) NeedView:(BOOL) aIsImageView
{
    if(aIsImageView)
    {
        [m_TableView removeFromSuperview];
        [self.view addSubviews:m_ImageView];
    }
    else 
    {
        [m_ImageView removeFromSuperview];
        [self.view addSubviews:m_TableView];
    }
}

这篇关于如何用图片替换 UITableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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