分页控制器

.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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容