Multiple Launch image of iOS -
my app has terms&condition page. visible first time after app install. after accept terms never shows user.
i have make launch image first page, not terms page. should not standard first time after app install.
so how can use 2 launch image based on condition?
if set portrait mode app (for both iphone , ipad), apple reject that?
thanks!
i solved this way:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; // ... stuff if( [defaults objectforkey:@"gtcaccepted"] ) { [self performselector:@selector(gtcaccepted)]; // } else { gtcviewcontroller* gtcviewcontroller; // gtcviewcontroller normal uiviewcontroller //universal app if (ui_user_interface_idiom() == uiuserinterfaceidiompad) gtcviewcontroller = [[gtcviewcontroller alloc] initwithnibname:@"gtcviewcontroller-ipad" bundle:nil]; else gtcviewcontroller = [[gtcviewcontroller alloc] initwithnibname:@"gtcviewcontroller" bundle:nil]; [window setrootviewcontroller:gtcviewcontroller]; // can show modal vc [gtcviewcontroller release]; // if accepted, set [[nsuserdefaults standarduserdefaults] setbool:yes forkey:@"gtcaccepted"]; in gtcviewcontroller } }
and 2 launch images...
try code after accepting gtc
[[nsuserdefaults standarduserdefaults] setbool:yes forkey:@"gtcaccepted"]; nsurl *path2 = [[nsbundle mainbundle] urlforresource:@"default-568h@2x_2" withextension:@"png"]; nsurl *path = [[nsbundle mainbundle] urlforresource:@"default-568h@2x" withextension:@"png"]; [[nsfilemanager defaultmanager] removeitematurl:path error:nil]; // permission denied if([[nsfilemanager defaultmanager] copyitematurl:path2 tourl:path error:nil]) { nslog(@"startitem replaced!"); }else { nslog(@"oh oh... item not replaced!"); }
update:
code doesn't work on device, see permission denied on delete
by way, if run in on simulator starting xcode, override every time run. , here have no chance change image before app starts ;)
have fun :)
Comments
Post a Comment