基于故事板的模式登录屏幕示例 [英] Example for login screen modally based on storyboard

查看:145
本文介绍了基于故事板的模式登录屏幕示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习ios / xcode和路障。

I am learning ios/ xcode and at a roadblock.

我有一个tabbarcontroller +导航设计。如果用户没有登录,我需要提供登录屏幕。这是基本的层次结构。登录页面需要一个navigationBar(我按照的教程在栏上放了一个Go按钮。

I have a tabbarcontroller+navigation based design. I need to present a login screen if user is not logged in. Here is the basic heirarchy. The login page needs a navigationBar (as the tutorial I followed puts a "Go" button on the bar.

LoginController: (LTController.h,.m)

Main View:TabBarController>
                   NavigationController>View1>View1a
                   NavigationController>View2

我在模态视图,委托方法等方面阅读了很多帖子。其中大部分都是代码片段,不幸的是我的初学者水平有点过头。

I read lot of posts here on modal view, delegate method, etc. Most of them are code snippets which unfortunately are a bit over the head for my beginner level.

对于如何实现这一点感到很简单。特别是关于哪些文件需要更改的说明会很棒。

Would appreciate a simple explanation as to how to achieve this. Espacially a note on which files needs changes would be great.

谢谢

推荐答案

这是一个场景。它很简单。我只希望它会有用。

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

对于UITableBarController,为 storyboard id提供身份名称

For the UITableBarController give a name for identity to storyboard id

然后在您的ViewController类文件中,您具有正确的身份验证凭据>。?在那边做一些事情进行身份验证。然后按照此代码。它工作正常

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];
        } 

这篇关于基于故事板的模式登录屏幕示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆