Example for login screen modally based on storyboard

后端 未结 2 1802
清歌不尽
清歌不尽 2020-11-29 03:03

I am learning ios/ xcode and at a roadblock.

I have a tabbarcontroller+navigation based design. I need to present a login screen if user is not logged in. Here is th

2条回答
  •  渐次进展
    2020-11-29 03:41

    Here is scenario . Its so simple . I just hope that it will be useful.

    enter image description here

    For the UITableBarController give a name for identity to storyboard identer image description here

    Then in your ViewController class file You have the authentication credentials right >.? Do some stuff over there for authentication . then follow this code . It works fine

    - (IBAction)Login:(id)sender {
    
        if(authenticated)  // authenticated---> BOOL Value assign True only if Login Success
            {
                UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
                UITabBarController *obj=[storyboard instantiateViewControllerWithIdentifier:@"tab"];
                self.navigationController.navigationBarHidden=YES;
                [self.navigationController pushViewController:obj animated:YES];
            } 
    

提交回复
热议问题