How to replace UITableView with an image?

I have a UITableView that is empty by default until the user edits and adds data to it. I want to display an image with instructions that are displayed until the user edits it.

Image size so that it is ideally located between the navigation bar and the tab bar.

Is there any way to do this programmatically?

+3
source share
3 answers

you can use removeFromSuperviewto remove UITableViewfrom the super view, then add UIImageView.

Use the code below:

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

UIView, UITableView . UIImageView . imageView View. ViewWillAppear . , :

- (void)tableView:(UITableView *)tableView
    commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
    forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete)
        // do delete
        // get count of rows in UITableView and hide table if it empty
    }
...
+1

, , ( (0, 44, 320, 392)). ( , u ), , .

.

0

All Articles