3
votes

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);
1

1 Answers

3
votes

Try sticking it in viewDidAppear instead of viewWillAppear.