I’m starting to convert iPhone App to iPad, the app is a special calculator and has a feel and look like one. on iPhone is to use portrait since it the best fit.
My questions are:
i. when I run it on the iPad do i need to use the whole iPad screen size? I would like just to upscale all my controls size and width by let’s say 125% of the original size. How do I check the device screen size and how do I center my calculator to be in the center when running on iPad? currently the iPad is CGRectMake(0,0,640,1024) but it may change in the future.
ii. I also like it to adjust accordingly on both orientations of the iPad but only portrait on the iPhone. and I’m not sure how to do it in the most effective-easy way… if you may advice.
my current iPhone code has .xib with the different controls but I adjust them all using the
-setFrame:CGRectMake(...) in code, so far I set the TARGETED_DEVICE_FAMILY in project settings to run app on both devices but didn’t change any of the -setFrame:CGRectMake(...) to be dynamic depending on the device.
TIA
1) You can ask [UIScreen mainScreen] for its bounds – that gives you the size.
2) You need to respond to the rotation methods in your UIViewController related to rotation:
3) You can use this to find out if your app is running on an iPhone or iPad:
4) To center the view in a larger view use this code: