美文网首页
分页控制器

分页控制器

作者: J_mine | 来源:发表于2017-09-18 09:06 被阅读0次

.h文件

#import <UIKit/UIKit.h>

@interface DLViewController : UITabBarController

@end

.m文件



#import "DLViewController.h"

#import "FirstViewController.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"
#import "FourthViewController.h"
@interface DLViewController ()

@end

@implementation DLViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    FirstViewController *theFirst = [[FirstViewController alloc] init];
    theFirst.title = @"首页";
    theFirst.tabBarItem.image = [UIImage imageNamed:@"1"];
    
    SecondViewController *theSec = [[SecondViewController alloc] init];
    theSec.title = @"视频";
    theSec.tabBarItem.image = [UIImage imageNamed:@"5"];
    
    
    ThirdViewController *theThird = [[ThirdViewController alloc] init];
    theThird.title = @"关注";
    theThird.tabBarItem.image = [UIImage imageNamed:@"3"];
// 红点
    theThird.tabBarItem.badgeValue = @"100";
    
    
    FourthViewController *theFourth = [[FourthViewController alloc] init];
    theFourth.title = @"我的";
    theFourth.tabBarItem.image = [UIImage imageNamed:@"6"];
    
    UINavigationController *theNav1 = [[UINavigationController alloc] initWithRootViewController:theFirst];
    UINavigationController *theNav2 = [[UINavigationController alloc] initWithRootViewController:theSec];
    UINavigationController *theNav3 = [[UINavigationController alloc] initWithRootViewController:theThird];
    UINavigationController *theNav4 = [[UINavigationController alloc] initWithRootViewController:theFourth];
    
    self.viewControllers = @[theNav1,theNav2,theNav3,theNav4];
    
}


@end

相关文章

网友评论

      本文标题:分页控制器

      本文链接:https://www.haomeiwen.com/subject/rfuvsxtx.html