I want to connect a viewcontroller to a viewcontroller a user can only see once they tap the below function. How do i specify this? I know there is supposed to be some storyboard connectivity here but IDK how.

//relevant code specified in LoginScreen.m checks `register and login IBAction buttons and connects to ancillary web api stack`
NSString* command = (sender.tag==1)?@"register":@"login";
NSMutableDictionary* params =[NSMutableDictionary dictionaryWithObjectsAndKeys:command, @"command", fldUsername.text, @"username", hashedPassword, @"password", nil];
//make the call to the web API
[[API sharedInstance] commandWithParams:params onCompletion:^(NSDictionary *json) {
    //result returned
    NSDictionary* res = [[json objectForKey:@"result"] objectAtIndex:0];
    if ([json objectForKey:@"error"]==nil && [[res objectForKey:@"IdUser"] intValue]>0) {
        [[API sharedInstance] setUser: res];
        [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
        //show message to the user
        [[[UIAlertView alloc] initWithTitle:@"Logged in" message:[NSString stringWithFormat:@"Welcome %@",[res objectForKey:@"username"]] delegate:nil cancelButtonTitle:@"Close" otherButtonTitles: nil] show];
    } else {
        //error
        [UIAlertView error:[json objectForKey:@"error"]];
    }


//ie: pseudo code

fake function (login or register)
if (login or register)
[perform segue : NewViewController]





//Photoscreen.m checks wether a user is authentic when a navigation item is tapped and segues them to the login screen if not

-(void)viewDidLoad {
[super viewDidLoad];
// Custom initialization
self.navigationItem.rightBarButtonItem = btnAction;
self.navigationItem.title = @"Post photo";
if (![[API sharedInstance] isAuthorized]) {
    [self performSegueWithIdentifier:@"ShowLogin" sender:nil];
}

Related posts

Recent Viewed