how to get previous view when entered in foreground in ios -
i've chat view,i'm chating , when enter in background,and once again enter in foreground message have been removed(refresh),how can got same chat message.
- (void)applicationwillenterforeground:(uiapplication *)application { // called part of transition background inactive state; here can undo many of changes made on entering background. [[uiapplication sharedapplication] cancelalllocalnotifications]; application.applicationiconbadgenumber = 0; self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; sphviewcontroller *chatview = [[sphviewcontroller alloc] initwithnibname:@"sphviewcontroller" bundle:nil]; chatview.strcallername = [nsstring stringwithformat:@"%@",strselectedcallername]; self.window.rootviewcontroller = chatview; [self.window makekeyandvisible]; }
you resetting app state every time app enters foreground. that's not place instantiate view controller , set app's main window. need in applicationdidfinishlaunching:
Comments
Post a Comment