代码库> 导航> 自定义的累似UINavigationController
自定义的累似UINavigationController
关注
上传者:qq741827517 分类:导航(Navigation)
查看次数:2905 下载次数:22
上传时间:2015-06-30 大小:
//
//  ViewController.m
//  SelfNavi
//
//  Created by  Calvin.Nie on 15/6/30.
//  Copyright (c) 2015年 Calvin.Nie. All rights reserved.
//

#import "ViewController.h"
#import "BarItem.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self loadAllView];
}
-(void)loadAllView
{
    _selectView=[[UIView alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width/4.*3, 0, [UIScreen mainScreen].bounds.size.width/4., 44)];
    _selectView.backgroundColor=[UIColor whiteColor];
    _selectView.alpha=0.7;
    
    _navi=[[NaviToolbar alloc]initWithFrame:CGRectMake(0,[UIScreen mainScreen].bounds.size.height-44, [UIScreen mainScreen].bounds.size.width, 44)];
    _navi.backgroundColor=[UIColor blackColor];
    
    [self.view addSubview:_navi];
    
    _frist=[[FristViewController alloc]init];
    [_frist view];
  
    [self.view insertSubview:_frist.view belowSubview:_navi];
    
    _second=[[SecondViewController alloc]init];
    [self.view insertSubview:_second.view belowSubview:_navi];
    
    _three=[[ThreeViewController alloc]init];
    [self.view insertSubview:_three.view belowSubview:_navi];
    
    _third=[[ThirdViewController alloc]init];
    [self.view insertSubview:_third.view belowSubview:_navi];
    
    NSMutableArray *m_allBar=[[NSMutableArray alloc]init];
    
    BarItem *b1=[[BarItem alloc]initWithImage:[UIImage imageNamed:@"1"] style:UIBarButtonItemStylePlain target:self action:YES Viewcontroller:_frist];
    b1.delegate=self;
   BarItem *b2=[[BarItem alloc]initWithImage:[UIImage imageNamed:@"2"] style:
        UIBarButtonItemStylePlain target:self action:YES Viewcontroller:_second];
    b2.delegate=self;
    BarItem *b3=[[BarItem alloc]initWithImage:[UIImage imageNamed:@"3"] style:UIBarButtonItemStylePlain target:self action:YES Viewcontroller:_three];
    b3.delegate=self;
    BarItem *b4=[[BarItem alloc]initWithImage:[UIImage imageNamed:@"4"] style:UIBarButtonItemStylePlain target:self action:YES Viewcontroller:_third];
    b4.delegate=self;
    
    [m_allBar addObject:b1];
    [m_allBar addObject:b2];
    [m_allBar addObject:b3];
    [m_allBar addObject:b4];
    
    [_navi setItems:m_allBar];
    [_navi addSubview:_selectView];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)switchView:(UIButton *)sender
{
    NSLog(@"----------%d",sender.tag);
    _selectView.frame=CGRectMake([UIScreen mainScreen].bounds.size.width/4.*(sender.tag-1), 0, [UIScreen mainScreen].bounds.size.width/4., 44);
    switch (sender.tag) {
        case 1:
        {
            [self.view insertSubview:_frist.view belowSubview:_navi];
            
        }
            break;
        case 2:
        {
            [self.view insertSubview:_second.view belowSubview:_navi];

        }
            break;
        case 3:
        {
            [self.view insertSubview:_three.view belowSubview:_navi];

        }
            break;
        case 4:
        {
            [self.view insertSubview:_third.view belowSubview:_navi];
        }
            break;

        default:
            break;
    }
}
@end
收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0


下载过该代码的还下载了
综合评论
  • 您好  请问demo可以展示图片, 但是放到我的工程项目里面 ...
    18640768232 评论了 DDPhotoBrowser
  • 我主页开源很多精品喜欢来个小星星 https://gitee.com/cocoscreat...
    17069818154 评论了 CocosCreator左右跳
  • 1
    15777131570 评论了 Swift5高仿最新有妖气APP
  • mark!!!
    18810473635 评论了 瀑布流布局
  • 写Demo用cocoaPods的都是**
    抠脚小金刚 评论了 混合轮播图
  • 楼主竟然把公司的项目发到网上,估计只有一种可能了,就是当初被公司坑了,怀恨在心,就像当年我删库跑路一...
    13816490147 评论了 商城
提示
sina weixin mail 回到顶部