dimanche 10 mai 2015

[IOS]How to dynamic delete view from tableviewcell using autolayout

I'm a objective-c beginner.I want to achieve a demo likes twitter.Now I'm trying to dynamic delete a subview from tableviewcell,and I using autolayout.As we know some twitters include image(or forwarding content) and some have not.So I use tableview.cell.hidden=YES to hidden a cell who does not include forwarding content,like this:

    if(retweetedStatus.text != nil) {
        User *retweetedUser = [retweetedStatus user];
        NSString *strRetweetedStatus = [[NSString alloc]initWithFormat:@"@%@:%@",retweetedUser.screenName, retweetedStatus.text];
        cell.retweetedStatusLabel.text = strRetweetedStatus;
        cell.retweetedStatusLabel.hidden = NO;    
    } else {
        cell.retweetedStatusLabel.hidden = YES;
    }

So my issue is when a subview of cell has set hidden and it is still occupied space.In addition,my dynamic tableview reference this blog: http://ift.tt/1LLxdHj Who can tell me how to fix this issue,thanks!

Aucun commentaire:

Enregistrer un commentaire