daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Jul 22nd, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  2.  
  3. // Override point for customization after application launch.
  4. tabBarController.delegate = self;
  5.  
  6. // Add the tab bar controller's view to the window and display.
  7. self.window.rootViewController = self.tabBarController;
  8. [self addTabBarArrow];
  9.  
  10. LoginViewController *loginViewController = [[LoginViewController alloc] init];;
  11. [window addSubview:tabBarController.view];
  12. [self.tabBarController presentModalViewController:loginViewController animated:YES];
  13. [window makeKeyAndVisible];
  14. return YES; }
  15.    
  16. @protocol PassUserInfoDelegate <NSObject>
  17. @required
  18. - (void) passUserInfo: (NSString *)string;
  19. @end
  20.    
  21. -(void)connectionDidFinishLoading:(NSURLConnection *)connection {
  22. NSString *respuestaServidor = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
  23. self.responseData = nil;
  24.  
  25. NSDictionary *dictionary = [respuestaServidor JSONValue];
  26. idJson = [dictionary objectForKey:@"id"];
  27. NSString *user_loginJson = [dictionary objectForKey:@"user_login"];
  28.  
  29. if ([idJson isEqualToString:@"null"] && [user_loginJson isEqualToString:@"null"]) {
  30.     NSLog(@"Login incorrecto");
  31. } else {
  32.     NSLog(@"Procedo a loguear usuario");
  33. }
  34. [indicator stopAnimating];
  35. [indicator release];
  36. }
  37.    
  38. @interface HomeViewController : UIViewController <PassUserInfoDelegate> {
  39. LoginViewController *protocolTest;
  40. IBOutlet UILabel *nombreUsuario;
  41. NSString *usuario;
  42. }
  43. @property (nonatomic, retain) IBOutlet UILabel *nombreUsuario;
  44. @property (copy) NSString *usuario;
  45.  
  46. - (void) passUserInfo:(NSString *)string;
  47.  
  48. @end
  49.    
  50. - (void) passUserInfo:(NSString *)jSonString
  51. {
  52.     userName.text = [[NSString alloc] initWithFormat:@"Welcome %@", jSonString];
  53. }
  54.    
  55. -(void) viewDidAppear:(BOOL)animated{
  56. protocolTest = [[LoginViewController alloc] init];
  57. [protocolTest setDelegate:self];
  58. [protocolTest loginSuccess];
  59. }
  60.    
  61. - (void)loginSuccess
  62. {
  63.     [[self delegate] passUserInfo:idJson];
  64. }
  65.    
  66. [[self delegate] passUserInfo:@"hello"];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top