I have an app that I want a button's frame size to change on different devices when another button is tapped. When I tap the button on the iPad the other button's frame size changes and changes back when another button is tapped. However this does not happen when on an iPhone.
this is the original size on the iphone (568 height) button.frame = CGRectMake(18,456,126,13);
other height button.frame = CGRectMake(18,370,126,13);
and this is the size on the iPad
button.frame = CGRectMake(47,577,251,26);
this is the code to change the size of the button when the other button is tapped
-(IBAction)changeSize:(id)sender{
if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
int height = [UIScreen mainScreen].bounds.size.height;
if (height == 568) {
self.button.frame = CGRectMake(18,339,100,13);
}
else {
self.button.frame = CGRectMake(18,279,100,13);
}
}
else if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
self.button.frame = CGRectMake(47,603,200,26);
}
Like I said it works fine changing the button size on the iPad but not on the iPhone. Any suggestions?
Thanks
So I had auto layout enable for the iPhone and not for the iPad. Once I disabled it on the iPhone it worked perfectly.