手机QQ底部分栏效果标签栏

Posted pengyuan_D

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了手机QQ底部分栏效果标签栏相关的知识,希望对你有一定的参考价值。

AppDelegate.m

//
//  AppDelegate.m
//  Task5
//
//  Created by lyb on 14-9-27.
//  Copyright (c) 2014年 imac. All rights reserved.
//

#import "AppDelegate.h"
#import "FirstViewController.h"
#import "SecondViewController.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    FirstViewController *firstCtrl = [[FirstViewController alloc] init];
    SecondViewController *secondCtrl =[[SecondViewController alloc] init];
    
    UINavigationController *navCtrl1 = [[UINavigationController alloc] initWithRootViewController:firstCtrl];
    UINavigationController *navCtrl2 = [[UINavigationController alloc] initWithRootViewController:secondCtrl];
    
    UITabBarController *tabbarCtrl = [[UITabBarController alloc] init];
    tabbarCtrl.viewControllers = @[navCtrl1, navCtrl2];
    
    self.window.rootViewController = tabbarCtrl;
    
    return YES;



@end

FirstViewController.m

- (void)viewDidLoad

    [super viewDidLoad];

    self.title = @"左";
    
    self.view.backgroundColor = [UIColor redColor];

SecondViewController.m

#import "SecondViewController.h"
#import "ThirdViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) 
        self.title = @"右";
    
    return self;


- (void)viewDidLoad

    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor greenColor];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];
    button.frame = CGRectMake(90, 90, 90, 50);
    [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];


- (void)buttonAction

    ThirdViewController *thirdCtrl = [[ThirdViewController alloc] init];
    
    [self.navigationController pushViewController:thirdCtrl animated:YES];

ThirdViewController.m

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) 
        //隐藏标签栏工具栏
        self.hidesBottomBarWhenPushed = YES;
    
    return self;


- (void)viewDidLoad

    [super viewDidLoad];

    self.view.backgroundColor = [UIColor orangeColor];
    self.title = @"三";
    



以上是关于手机QQ底部分栏效果标签栏的主要内容,如果未能解决你的问题,请参考以下文章

仿Android新版手机QQ底部动态按钮效果

Android 沉浸式/透明式状态栏、导航栏

记Vue中即时页面填充内容不够,底部栏也可在浏览器最底端显示方法

Android碎片Fragment之多标签切换效果(微信和QQ底部多标签切换)

关于edgesForExtendedLayouttranslucentextendedLayoutIncludesOpaqueBarsautomaticallyAdjustsScrollView(代码

Java 实现 Word 文档分栏效果