lolol
lolol

Reputation: 4390

changing self.view frame doesn't work

I have the following structure:

UIViewController > UIView (self.view) > UITableView (self.tableView - IBOutlet)

I'm trying to move the whole thing up by 59 pixels, I tried:

- (void)viewWillAppear:(BOOL)animated {

    self.view.frame = CGRectMake(0, -59, 320, 367 + 59);
    // or
    self.tableViewMe.frame = CGRectMake(0, -59, 320, 367 + 59);;

    NSLog(@"%f", self.view.frame.origin.x);
    NSLog(@"%f", self.view.frame.origin.y);
    NSLog(@"%f", self.view.frame.size.width);
    NSLog(@"%f", self.view.frame.size.height);

    NSLog(@"%f", self.tableView.frame.origin.x);
    NSLog(@"%f", self.tableView.frame.origin.y);
    NSLog(@"%f", self.tableView.frame.size.width);
    NSLog(@"%f", self.tableView.frame.size.height);

    [super viewWillAppear:animated];

}

The coordinates are right but the view and the table are the same, not moving at all. Besides, If I add the following code to a IBAction, like a button tap, then it works:

self.view.frame = CGRectMake(0, -59, 320, 367 + 59);

Upvotes: 3

Views: 3072

Answers (1)

Fogmeister
Fogmeister

Reputation: 77661

Try sticking it in viewDidAppear instead of viewWillAppear.

Upvotes: 3

Related Questions