Guilherme Mendonca
Guilherme Mendonca

Reputation: 3

add UIButton in the space not used by a TableView

I'm in a UITableView implementation file, and used :

- (void)viewDidAppear:(BOOL)animated
{
    [self.tableView setFrame:CGRectMake(x, y, w, h)];
}

So my table view do not occupy the entire screen so I could display buttons in the space left, but

[self.view addSubview:myButton];

does not seems to work to make the button appear in that space left. I think thats because its adding the button inside the table view since 'self' is the table view. But I don't know the solution to use the empty space, any help?

Upvotes: 0

Views: 47

Answers (1)

Ricardo Sanchez-Saez
Ricardo Sanchez-Saez

Reputation: 9566

You cannot add buttons like that into an UITableView (mainly because it's a subclass of UIScrollView).

I suggest you use a UIViewController instead, and add your UITableView plus any additional views you need to the main controller view.

Upvotes: 1

Related Questions