Вопрос

I have a UITableView called Facebook that contents two buttons, sometimes only is necesary show one button, but I have a problem because there are a empty space and this is not pretty in my app. I want resize this view but, nothing happens, only the FacebookButtonLogin is hidden, but the view is not resized.

-(void) viewDidLoad
{     
        self.FacebookButtonLogin.hidden = YES;
        CGRect newSize = self.Facebook.frame;
        newSize.origin.x = 0;
        newSize.origin.y = 0;
        newSize.size.width = self.cellFacebook.frame.size.width;
        newSize.size.height = UI_USER_INTERFACE_IDIOM() ? 48 : 48;
        //[[self Facebook]setFrame:newSize];
        self.Facebook.frame = newSize;
}

Thanks in advance!

Это было полезно?

Решение

The height a particular row is controlled by the method tableView:heightForRowAtIndexPath: of you UITableViewDelegate. You cannot manually change the size of a cell, it is resized by the TableView to the cell size (tableView width and row height) when it layouts its subviews.

On another point, what it the point of this line:

newSize.size.height = UI_USER_INTERFACE_IDIOM() ? 48 : 48;

It sets the same value and compares the idiom to 0 instead of iPhone or iPad (one of them might have the value 0, so the check might be working for now, but using the constants is better).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top