分页控制器

.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

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

推荐阅读更多精彩内容

  • 之前一直想要找的分页效果一直找不到,就自己写了一个 大神求点评,先上效果图和层次图 其他不说了,直接上代码吧新建一...
    _Comma阅读 2,870评论 0 3
  • demo链接作为一名iOS开发,最常用到的就是分页控制器了,类似于新闻首页;先看下图,我们做的到底是个什么东西,图...
    庞仕山阅读 10,485评论 2 4
  • 这一篇文章讲解如何实现一个分页控制器,效果图如下: 这是我参考别人的思路(忘记是哪个了)实现的一个框架,使用起来非...
    BohrIsLay阅读 4,406评论 0 3
  • 刚换了一家新公司,接触的新项目,项目比较老,分页列表直接用的scrollView做的,添加好几个tableView...
    ytsq阅读 9,726评论 0 4