• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ios - 注册或登录 iOS7 后如何显示标签栏

[复制链接]
菜鸟教程小白 发表于 2022-12-12 11:24:12 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

基本上我有一个基于标签的应用程序,它首先需要从登录页面登录/注册,然后才能看到标签栏,我已经在这个页面上运行了大约 3 个小时,但还没有解决方案!

所以它更像: LandingCtrl(tabBarNotvisible)-> LoginCtrl(tabBarNotvisible)-> profile(tabBarvisible)

这是我尝试过的:

appdelegate.m

- (BOOL)applicationUIApplication *)application didFinishLaunchingWithOptionsNSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];

    // Initialize tab controllers.  with each tab has its own navigation controller
    ProfileViewController *profileViewController =[[ProfileViewController alloc]init];
    UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:profileViewController];
    [nav1 setTitle"rofile"];

    DiscoverViewController *discoverViewController=[[DiscoverViewController alloc]init];
    UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:discoverViewController];
    [nav2 setTitle"Discover"];

    RecievedViewController *recievedViewController = [[RecievedViewController alloc]init];
    UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:recievedViewController];
    [nav3 setTitle"Recieved"];

    // initialize tabbarcontroller and set your viewcontrollers.
    self.tabBarController = [[UITabBarController alloc]init];
    self.tabBarController.viewControllers=[NSArray arrayWithObjects:nav1,nav2,nav3, nil];

    // Inititalize Navigationcontroller and set root as tabbar.
    self.navBarController = [[UINavigationController alloc]initWithRootViewController:self.tabBarController];

    LandingViewController *landingviewcontroller = [[LandingViewController alloc] init];
    UINavigationController *nVC = [[UINavigationController alloc] initWithRootViewController:landingviewcontroller];
    nVC = [[UINavigationController alloc]initWithRootViewController:landingviewcontroller];
    nVC.navigationBar.barTintColor = [UIColor colorWithRed:0.204 green:0.286 blue:0.369 alpha:1];
    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-100.f, 0) forBarMetrics:UIBarMetricsDefault];
    nVC.navigationBar.tintColor = [UIColor whiteColor];
    nVC.navigationBar.translucent = NO;

    [self.window addSubview:self.tabBarController. view];
    [self.tabBarController presentViewController:nVC animated:YES completion:nil];
    //[self.window setRootViewController:nVC];
    [self.window makeKeyAndVisible];

    return YES;
}

仍然无法让该死的东西工作,我非常感谢您的帮助,谢谢!!!!!!



Best Answer-推荐答案


我正在关注以下代码。这对我有用,检查一次。您应该先创建登录页面,然后在登录页面上创建此逻辑。

NewHomeView *home=[[NewHomeView alloc]initWithNibName"NewHomeView_iPad" bundle:nil];
        UIImage *imag=[UIImage imageNamed"profile40x40.png"];
        [home setTabBarItem:[[UITabBarItem alloc]initWithTitle"Home" image:imag tag:100]];

        BiographyView *biography= [[BiographyView alloc] initWithNibName"BiographyView_iPad" bundle:nil];
        UIImage *imag1=[UIImage imageNamed"Biography40x40.png"];
        [biography setTabBarItem:[[UITabBarItem alloc]initWithTitle"Biography" image:imag1 tag:101]];

        GalleryView *gallery = [[GalleryView alloc] initWithNibName"GalleryView_iPad" bundle:nil];
        UIImage *imag2=[UIImage imageNamed:@"Gallery40x40.png"];
        [gallery setTabBarItem:[[UITabBarItem alloc]initWithTitle:@"Gallery" image:imag2 tag:102]];

        VideosView *video = [[VideosView alloc] initWithNibName:@"VideosView_iPad" bundle:nil];
        UIImage *imag3=[UIImage imageNamed:@"Videos40x40.png"];
        [video setTabBarItem:[[UITabBarItem alloc]initWithTitle:@"Videos" image:imag3 tag:103]];


        MoviesView *movies = [[MoviesView alloc] initWithNibName:@"MoviesView_iPad" bundle:nil];
        UIImage *imag4=[UIImage imageNamed:@"Movies40x40.png"];
        [movies setTabBarItem:[[UITabBarItem alloc]initWithTitle:@"Movies" image:imag4 tag:104]];


        NewsView *news = [[NewsView alloc] initWithNibName:@"NewsView_iPad" bundle:nil];
        UIImage *imag5=[UIImage imageNamed:@"news40x40.png"];
        [news setTabBarItem:[[UITabBarItem alloc]initWithTitle:@"News" image:imag5 tag:105]];

        tabController = [[UITabBarController alloc] init];
        [tabController setViewControllers:[NSArray arrayWithObjects:home, biography, gallery,video,movies,news, nil]];

      [self.navigationController pushViewController:tabController animated:YES];

关于ios - 注册或登录 iOS7 后如何显示标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25255890/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap