ios - Load different viewcontroller in Xcode5 -


I am working on a simple application for iOS in Xcode 5.1.1. I'm a newbie in Xcode and Objective-C, so I have a little problem. I have it: Enter image details here

The idea of ​​my application is very simple - When user launches the application for the first time, they see the authorization form. When he enters his login and password and pressed sign in, my application requests the server, and if everything is ok - login and password are correct - to save the user login:

  NSUserDefaults * defaults = [NSUserDefaults Standard User Defaults]; [Default set object: self.txtUsername.text forKey: @ "SavedUserName"]; [Synchronize default];   

And "It's OK!" The scene opens with

  [Personal Performance from Self Display: @ "Login_Success" Sender: Self];   

The authorization work is great, user login works for the savings OS. But now, when the user launches app again needs to open the scene with "this is ok", if he is already authorized:

  - (zero) viewDidoad {NSUsIR defaults * Default = [NSUser Defaults standard user default]; NSString * authLogin = [for erroneous object: @ "SavedUserName"]; If (! [AuthLogin isEqualToString: @ ""]) {// I think the application here is "OK!" Will have to load the scene with, but how to do it? // I tried to use it here - [self display CJU with identifier: @ "login_success" sender: self]; But it does not work}}   

Please help me, how to solve my problem? I try to find the answer to my question on Google and Stack Overflow here, but whatever I am getting and trying to use it does not help me.

My application also handles some authorization flows (PIN-registration) I work with two storyboards

The following code is under the application: didFinishLaunchingWithOptions: after some initials:

  // Set the root view (check that the user registered Is or not) self.window = [[UIWindow alloc] initWithFrame: [UIScreen main screen]. Bounce]; If ([ccmpService is registered]) {UIStoryboard * Storyboard = [UIStoryboard storyboardWithName: @ "Main" bundle: zero]; self.window.rootViewController = [Storyboard Instantial Visual Remote Control]; If (Launch option) {NSDictionary * RemoteNotiff = [Launch Option ObjectForcae: UI application launch option Remonant Notification]; [Self Handle Remote Notification: Remote Notip]; }} And {UIStoryboard * Storyboard = [UIStoryboard storyboardWithName: @ "Login" bundle: zero]; Self.window.rootViewController = [Storyboard Institution Instant Buyer]; } [Self. Windows MacKay and Episible]; Yes come back   



When I want to change the storyboard (login / logout), I make some call (app delegate also declared: < [UIStoryboard * Storyboard = [UIStoryboard storyboardWithName: @ "Main" bundle: Zero]; UIViewController * sourcetVC = self.window.rootViewController; UIViewController * destVC = [Storyboard Institutional Visual Controller]; [UIView transitionFromView: sourcetVC.view toview: destVC.view Duration: 0.5 Option: UIViewAnimationOptionTransitionFlipFromRight Complete: ^ (BOOL Finish) {self.window.rootViewController = destVC;}]

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -