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

查看:125
本文介绍了如何用图像替换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天全站免登陆