Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the frame for iphone 4 and iphone 5 in ios6

I want to update my application to ios 6. so how to set the frame size comfortable both iphone 4 and iphone 5?

like image 202
Ben10 Avatar asked Oct 10 '12 07:10

Ben10


1 Answers

I can using Calculate the Screen size then to adjust the height of the view like using following method

+(CGFloat)heightOf:(CGFloat)heightValue{
CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];

//NSLog(@"applciation Frame height = %f",applicationFrame.size.height);
CGFloat heightRatio = (heightValue/480)*100;

CGFloat height = (applicationFrame.size.height * heightRatio)/100;
return height;

}

then I am using like as

UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0,[Height heightOf:385], 320, 220)];

and so. Thanks for your Replies

like image 122
Ben10 Avatar answered Sep 20 '22 20:09

Ben10