This is the code I'm using:
-(void)viewDidLayoutSubviews{
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
if (screenSize.height <= 480.0f) {
self.img.frame = CGRectMake(21, 20, 280, 275);
self.text.frame = CGRectMake(21, 20, 280, 275);
self.decrease.frame= CGRectMake(55, 308, 39, 39);
self.add.frame = CGRectMake(55, 308, 39, 39);
self.increase.frame =CGRectMake(55, 308, 39, 39);
}
else{
self.img.frame = CGRectMake(21, 20, 280, 400);
self.text.frame = CGRectMake(21, 20, 280, 400);
self.decrease.frame= CGRectMake(55, 308, 39, 39);
self.add.frame = CGRectMake(55, 308, 39, 39);
}
}
I'm using the same code (outside of the viewDidLayoutSubviews) to alter the frames and it works perfectly. My problem is that the code in viewDidLayoutSubviews doesn't work. It doesn't alter the frames sizes or positions upon loading the view. Any suggestions?