I have lot of UiImageViews on my UIView and I create/place them differently based on Ipad or iPhone co-ordinates. Here is my current logic to create Frames for these UIImageViews
- (void)setAnimationFrame:(NSString *)imageName iPadFrameX:(int)iPadX iPadFrameY:(int)iPadY iPhoneFrameX:(int)iPhoneX iPhoneFrameY:(int)iPhoneY imageSizePercentForiPad:(CGFloat)imageSizePercentForiPad imageSizePercentForiPhone:(CGFloat)imageSizePercentForiPhone animationNumber:(int)animationNumber imageAnimationView:(UIImageView *)imageAnimationView{
int tagNumber;
tagNumber = [self getTagNumber:animationNumber];
UIImage *image = [UIImage imageNamed:imageName];
CGRect frame;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
frame = CGRectMake(iPadX, iPadY, image.size.width*imageSizePercentForiPad, image.size.height*imageSizePercentForiPad);
}
else
{
frame = CGRectMake(iPhoneX, iPhoneY, image.size.width*imageSizePercentForiPhone, image.size.height*imageSizePercentForiPhone);
}
imageAnimationView.frame = frame;
imageAnimationView.image = image;
imageAnimationView.tag = tagNumber;
}
I do lot of UIImageView animations by passing an array of images to UIImageView.animationImages through out my app. Now what is the best way to handle such scenarios with iPhone 5 compatibility?
Do I add one more else condition inside if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
to handle iPhone 5 by calculating its co-ordinates or there is a better way. I would greatly appreciate your suggestions.