ios - How To Create a iPad Device Difference Using Objective C? -
i trying create programmatically multiple devices
screen sizes
multiple ui differences on sizes. below code using different sizes
within condition ipad
screen sizes not showing full screen. me create full screen sizes within different device ipad.
my code below :
if (ui_user_interface_idiom() == uiuserinterfaceidiompad) { // device ipad , ipad mini running ios 3.2 or later. cgsize result = [[uiscreen mainscreen] bounds].size; if(result.height == 1366) { // ipad, ipad 2, ipad mini splashimage.frame = cgrectmake(0, 0, 768,result.height); [splashimage setimage:[uiimage imagenamed: @"default-portrait.png" ]]; activityindicator.frame=cgrectmake(145, 240, 30, 30); } if(result.height == 2008) { // ipad air, ipad mini retina splashimage.frame = cgrectmake(0, 0, 1536,result.height); [splashimage setimage:[uiimage imagenamed: @"default-portrait@2x.png" ]]; activityindicator.frame=cgrectmake(145, 240, 30, 30); } }
i feel there wrong in approach.
-use autoresizing feature ,which expands screen based on screen resolution.
- ios automatically picks 2x or 3x image. no need of explicit code 2x image.
-use in places. not required mention 2x [splashimage setimage:[uiimage imagenamed: @"default-portrait.png" ]];
Comments
Post a Comment