objective c - How to move from a View to a Tab Bar Controller in iOS? -
i'm new ios , have issue.
i have view login form , button.
i want make once button pressed, login processed , if successful loads first tab of tab bar controller.
how do this? i've tried creating manual segue , loading doesn't work :(
here code happens after login (its github login form):
- (ibaction)login:(id)sender { boolean error = no; nsstring* username = _usernamefield.text; nsstring* password = _passwordfield.text; uicolor *red = [uicolor colorwithred:255/255.0f green:0/255.0f blue:0/255.0f alpha:1.0f]; uicolor *black = [uicolor colorwithred:0/255.0f green:0/255.0f blue:0/255.0f alpha:1.0f]; github* github = [[github alloc] init]; bool result = no; // checking blanks if([username isequaltostring:@""]) { [_usernamelabel settextcolor:red]; error = yes; } else { [_usernamelabel settextcolor:black]; } if([password isequaltostring:@""]) { [_passwordlabel settextcolor:red]; error = yes; } else { [_passwordlabel settextcolor:black]; } if(!error) { result = [github loginwithusername:username andpassword:password]; if(result == yes) { // logged in successfully! [_errorlabel sethidden:yes]; nslog(@"yep"); [self performseguewithidentifier:@"loginsegue" sender:self]; } else { // error handling [_errorlabel settext:@"error: incorrect username / password"]; [_errorlabel sethidden:no]; [_passwordfield settext:@""]; } } else { // error handling [_errorlabel settext:@"error: please correct errors below:"]; [_errorlabel sethidden:no]; [_passwordfield settext:@""]; } }
Comments
Post a Comment