Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- // Override point for customization after application launch.
- tabBarController.delegate = self;
- // Add the tab bar controller's view to the window and display.
- self.window.rootViewController = self.tabBarController;
- [self addTabBarArrow];
- LoginViewController *loginViewController = [[LoginViewController alloc] init];;
- [window addSubview:tabBarController.view];
- [self.tabBarController presentModalViewController:loginViewController animated:YES];
- [window makeKeyAndVisible];
- return YES; }
- @protocol PassUserInfoDelegate <NSObject>
- @required
- - (void) passUserInfo: (NSString *)string;
- @end
- -(void)connectionDidFinishLoading:(NSURLConnection *)connection {
- NSString *respuestaServidor = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
- self.responseData = nil;
- NSDictionary *dictionary = [respuestaServidor JSONValue];
- idJson = [dictionary objectForKey:@"id"];
- NSString *user_loginJson = [dictionary objectForKey:@"user_login"];
- if ([idJson isEqualToString:@"null"] && [user_loginJson isEqualToString:@"null"]) {
- NSLog(@"Login incorrecto");
- } else {
- NSLog(@"Procedo a loguear usuario");
- }
- [indicator stopAnimating];
- [indicator release];
- }
- @interface HomeViewController : UIViewController <PassUserInfoDelegate> {
- LoginViewController *protocolTest;
- IBOutlet UILabel *nombreUsuario;
- NSString *usuario;
- }
- @property (nonatomic, retain) IBOutlet UILabel *nombreUsuario;
- @property (copy) NSString *usuario;
- - (void) passUserInfo:(NSString *)string;
- @end
- - (void) passUserInfo:(NSString *)jSonString
- {
- userName.text = [[NSString alloc] initWithFormat:@"Welcome %@", jSonString];
- }
- -(void) viewDidAppear:(BOOL)animated{
- protocolTest = [[LoginViewController alloc] init];
- [protocolTest setDelegate:self];
- [protocolTest loginSuccess];
- }
- - (void)loginSuccess
- {
- [[self delegate] passUserInfo:idJson];
- }
- [[self delegate] passUserInfo:@"hello"];
Add Comment
Please, Sign In to add comment