Tuesday, 15 May 2012

How to create a modal view , for application launch in iOS? -



How to create a modal view , for application launch in iOS? -

how create modal view , maybe delegate check if first time application launches , show modal view dismiss button , in order inform user important?

i need view show first time application launched , never again.

you can achive using nsuserdefaults.

in delegate.h file

nsstring * firsttime;

in .m file

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil]; self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsstring *mystr = [defaults objectforkey:@"str"]; firsttime =mystr; if (firsttime.length==0) { uialertview *alert = [[uialertview alloc] initwithtitle:@"hi" message:@"you have open app first time" delegate:self cancelbuttontitle:@"ok" otherbuttontitles: nil]; [alert show]; [self firsttime]; } homecoming yes; } -(void)firsttime { nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsstring *mystr = @"first"; [defaults setobject:mystr forkey:@"str"]; [defaults synchronize]; }

ios modal-dialog modalviewcontroller

No comments:

Post a Comment