0

I got a weird problem and i don't know where/how to fix it...

i have 6 UITableViews on a UIViewController ( i'm using storyboard ), i would like to resize them in the ViewDidLoad but i cannot, the only way i found to resize them it is in the ViewDidAppear, the problem is when i rotate my simulator the frame become like in IB.

Could you please help me on this case ?

- (void)viewDidLoad
{
    [super viewDidLoad];
    [_hoursTable setScrollEnabled:NO];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(void)viewDidAppear:(BOOL)animated
{
    [_firstTable setFrame:CGRectMake(100, 0, 100, 768)];
    [_secTable setFrame:CGRectMake(200, 0, 100, 100)];
    [_thirdTable setFrame:CGRectMake(300, 0, 100, 100)];
    [_fourthTable setFrame:CGRectMake(400, 0, 100, 100)];
    [_fifthTable setFrame:CGRectMake(500, 0, 100, 100)];
    [_hoursTable setFrame:CGRectMake(600, 0, 100, 100)];
}
xGoPox
  • 674
  • 8
  • 23

1 Answers1

0

This type of code should be in layoutSubviews.

- (void)layoutSubviews {
    // your code here
}
lnafziger
  • 25,760
  • 8
  • 60
  • 101
  • Hmm ok now i get it, self.view is in ViewDidLoad and the subviews in layoutSubviews – xGoPox Nov 19 '12 at 12:41
  • doesnt change anything layoutSubviews doesn't get called .. my uitableviews are linked into IB.. does this change something ... ? – xGoPox Nov 19 '12 at 13:37
  • Is layoutSubviews getting called? – lnafziger Nov 19 '12 at 13:37
  • only if i add it to viewdidload – xGoPox Nov 19 '12 at 15:26
  • I updated my answer, make sure that you have the method implemented correctly, as it should be called. Docs: http://developer.apple.com/library/ios/ipad/#documentation/uikit/reference/uiview_class/uiview/uiview.html – lnafziger Nov 19 '12 at 16:41