#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
#import "AppDelegate.h"
#import "RootViewController.h"
@interface AppDelegate () @end @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]; UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:[[RootViewController alloc] init]];
//隐藏系统导航栏
navigation.navigationBarHidden = YES;
self.window.rootViewController = navigation; [self.window makeKeyAndVisible];
return YES;
} @end
#import <UIKit/UIKit.h>

@interface RootViewController : UIViewController

@end
#import "RootViewController.h"
#import "LFNavigationView.h"
#import "ViewController.h"
@interface RootViewController ()<LFNavigationViewDelegate,UITableViewDataSource,UITableViewDelegate>
{
UITableView *_tableView;
}
@property(nonatomic, strong) LFNavigationView *navigationView; @end @implementation RootViewController - (void)loadView{
[super loadView];
_tableView = [[UITableView alloc] initWithFrame:/*[[UIScreen mainScreen] bounds]*/CGRectMake(, , [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - ) style:UITableViewStylePlain];
_tableView.dataSource = self;
_tableView.delegate = self;
[self.view addSubview:_tableView];
} - (void)viewDidLoad {
[super viewDidLoad];
if([UIDevice currentDevice].systemVersion.floatValue >= ) {
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = NO;
self.modalPresentationCapturesStatusBarAppearance = NO;
}
[self setNavMethod];
} - (void)setNavMethod{
_navigationView = [[LFNavigationView alloc] initWithTitle:@"测试" WithLeftImage:nil WithLeftImageHighlighted:nil WithRightImage:nil WithRightImageHighlighted:nil WithViewControl:self];
[self.view addSubview:_navigationView];
} #pragma mark -- UITableViewDelegate --
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return ;
} - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return ;
} - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
cell.textLabel.text = [NSString stringWithFormat:@"test row:%lu",indexPath.row];
return cell;
} - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
ViewController *viewController = [[ViewController alloc] init];
[self.navigationController pushViewController:viewController animated:YES]; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
#import <UIKit/UIKit.h>

@protocol  LFNavigationViewDelegate <NSObject>

@optional
- (void)leftButtonAction:(UIButton *)button;//左边按钮点击
- (void)rightButtonAction;//右边按钮点击 @end @interface LFNavigationView : UIView @property(nonatomic, weak) UIButton *leftBtn;
@property(nonatomic, weak) UIButton *rigthBtn;
@property(nonatomic, strong) UIImageView *rigthImg;
@property(nonatomic, strong) UILabel *rigthLabel;
@property(nonatomic, strong) UILabel *titleLabel; - (id)initWithTitle:(NSString*)title WithLeftImage:(NSString*)leftImage WithLeftImageHighlighted:(NSString*)leftImageHighlighted WithRightImage:(NSString*)rightImage WithRightImageHighlighted:(NSString*)rigthImagehighlighted WithViewControl:(id<LFNavigationViewDelegate>) delegate; @end
#import "LFNavigationView.h"

@implementation LFNavigationView

- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) { }
return self;
} - (id)initWithTitle:(NSString*)title WithLeftImage:(NSString*)leftImage WithLeftImageHighlighted:(NSString*)leftImageHighlighted WithRightImage:(NSString*)rightImage WithRightImageHighlighted:(NSString*)rigthImagehighlighted WithViewControl:(id<LFNavigationViewDelegate>) delegate{
float Y = ;
if ([UIDevice currentDevice].systemVersion.floatValue >= ) {
Y = ;
}
self = [super initWithFrame:CGRectMake(, , [UIScreen mainScreen].bounds.size.width, +Y)];
if (self) {
UIView *bgView = [[UIView alloc] initWithFrame:self.frame];
bgView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"顶栏背景"]];
[self addSubview:bgView]; if (title) {
//标题
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(([UIScreen mainScreen].bounds.size.width - )/, Y, , )];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.text = title;
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont systemFontOfSize:];
[self addSubview:_titleLabel];
} if (leftImage) {
UIImageView *leftImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@",leftImage]] highlightedImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@",leftImageHighlighted]]];
leftImg.frame =CGRectMake(, , , );
[self addSubview:leftImg];
UIImageView *leftTapView = [[UIImageView alloc] initWithFrame:CGRectMake(, +Y, , )];
leftTapView.userInteractionEnabled = YES;
leftTapView.backgroundColor = [UIColor clearColor];
[self addSubview:leftTapView];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:delegate action:@selector(leftButtonAction:)];
tapGesture.numberOfTouchesRequired = ;
tapGesture.numberOfTapsRequired = ;
[leftTapView addGestureRecognizer:tapGesture];
}
} if (rightImage) {
_rigthImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@",rightImage]] highlightedImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@",rigthImagehighlighted]]];
_rigthImg.frame = CGRectMake([UIScreen mainScreen].bounds.size.width-, , , );
[self addSubview:_rigthImg]; _rigthLabel = [[UILabel alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - , , , )];
_rigthLabel.textColor = [UIColor whiteColor];
_rigthLabel.font = [UIFont systemFontOfSize:];
[self addSubview:_rigthLabel]; UIImageView *rightTapView = [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - , +Y, , )];
rightTapView.userInteractionEnabled = YES;
rightTapView.backgroundColor = [UIColor clearColor];
[self addSubview:rightTapView];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:delegate action:@selector(rightButtonAction)];
tapGesture.numberOfTouchesRequired = ;
tapGesture.numberOfTapsRequired = ;
[rightTapView addGestureRecognizer:tapGesture];
} return self;
} @end
#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@end
#import "ViewController.h"
#import "LFNavigationView.h"
@interface ViewController ()<LFNavigationViewDelegate> @property(nonatomic, strong) LFNavigationView *navigationView; @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor greenColor];
[self setNavMethod];
} - (void)setNavMethod{
_navigationView = [[LFNavigationView alloc] initWithTitle:@"控制器" WithLeftImage:@"返回按钮" WithLeftImageHighlighted:@"返回按钮_down" WithRightImage:@"加号图标" WithRightImageHighlighted:@"加号图标_down" WithViewControl:self];
[self.view addSubview:_navigationView];
} #pragma mark -- LFNavigationViewDelegate --
- (void)leftButtonAction:(UIButton *)button{
NSLog(@"%@",button);
[self.navigationController popToRootViewControllerAnimated:YES];
} -(void)rightButtonAction{
NSLog(@"should do somthing");
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

iOS 隐藏系统的导航,使用自定义的导航的更多相关文章

  1. 利用iOS原生系统进行人脸识别+自定义滤镜(GPUImage)

    人脸识别+滤镜效果(基于GPUImage实现的自定义滤镜) 最近碰到一个好玩的需求.说要客户端这边判定一下是否有人脸.在有的基础上.对相片做进一步的美化滤镜处理. 首先是人脸的识别判定; //将图片对 ...

  2. iOS 隐藏自定义tabbar

    iOS  隐藏自定义tabbar -(void)viewWillAppear:(BOOL)animated { NSArray *array=self.tabBarController.view.su ...

  3. ios7隐藏系统底部导航

    ios7隐藏系统底部导航 minimal-ui <meta id="viewport" name="viewport" content="wid ...

  4. iOS开发UI篇—使用xib自定义UItableviewcell实现一个简单的团购应用界面布局

    iOS开发UI篇—使用xib自定义UItableviewcell实现一个简单的团购应用界面布局 一.项目文件结构和plist文件 二.实现效果 三.代码示例 1.没有使用配套的类,而是直接使用xib文 ...

  5. iOS回顾笔记(08) -- 自定义Cell的类型和创建步骤总结

    iOS回顾笔记(08) -- 自定义Cell的类型和创建步骤总结 项目中我们常见的自定义cell主要分为两种 等高cell:如应用列表.功能列表 非等高cell:如微博列表.QQ聊天页面 下面对这 ...

  6. 显示iOS所有系统字体

    显示iOS所有系统字体 源码地址: https://github.com/YouXianMing/UI-Component-Collection 效果图: 便于你开发中寻找适合自己的字体, demo中 ...

  7. iOS开发之--最简单的导航按钮更换方法/导航颜色的改变

    有很多时候,我们需要用到导航,那么更换导航的时候,是在那用那修改,还是自定义一个导航,或者是声明一个代理方法,经过查资料和对导航属性的一些了解,用一种方法最为简单,就是在入口类里面添加一个方法,调用偏 ...

  8. html自定义垂直导航菜单(多级导航菜单,去掉font-awesome图标,添加自己的箭头图标)

    这次在原先html自定义垂直导航菜单的基础上做了比较大的改动: 1.去掉了font-awesome图标,上级菜单右边的箭头是自己用css写的,具体参考<css三角箭头>. 2.去掉了初始化 ...

  9. html自定义垂直导航菜单(加强版--自定义传入menu参数,支持JSONArray、JSArray、JSONObject、JSObject)

    在上一篇中我简单写了个html自定义垂直导航菜单,缺点很明显,里面的数据是固定死的,不能动态更改数据. 这里我重写了一个修改版的垂直二级导航菜单,将原先的menuBox.init(config);修改 ...

随机推荐

  1. [听课笔记]Professor Michael Cusumano's New Book:" Strategy Rules: Five Timeless Lessons from Bill Gates, Andy Grove, and Steve Jobs"

    1. Look Forward, Reason Back Extrapolate, interpret, then tie vision to concrete actions2. Make Big ...

  2. [英语学习]儿童英语 sesamestreet

    最近在和我的孩子学习汉语,用在自己学习英语方面,就是多看小故事,多看儿歌. 以前孙小小分享过这个网站www.sesamestreet.org 现在找出来看看,还是很不错的. 搜索elbows and ...

  3. spring mvc返回json字符串数据,只需要返回一个java bean对象就行,只要这个java bean 对象实现了序列化serializeable

    1.spring mvc返回json数据,只需要返回一个java bean对象就行,只要这个java bean 对象实现了序列化serializeable 2. @RequestMapping(val ...

  4. VR制作的规格分析

    因为UE4的演示资源更丰富一些,我这边把UE4的有代表性的演示都跑了一遍,同时也通过Rift确认效果,和里面的资源制作方式.   首先,UE4是基于物理渲染的引擎,大部分都是偏向图像真实的.使用的材质 ...

  5. JAVA NIO的理解

    在使用JAVA提供的Socket的IO方法时,服务端为了方便操作,会为每一个连接新建一个线程,一个线程处理一个客户端的数据交互.但是当大量客户端同服务端连接时,会创建大量的线程,线程之间的切换会严重影 ...

  6. C#创建Excel

    创建Workbook说白了就是创建一个Excel文件,当然在NPOI中更准确的表示是在内存中创建一个Workbook对象流. 本节作为第2章的开篇章节,将做较为详细的讲解,以帮助NPOI的学习者更好的 ...

  7. hdf第一周完了,突然时间静止.,醒了就早点去公司上班,再努力一点

    周一要了个任务,做评价完成,分享完成的页面,做到周四发现可能做不出来,找dzy,逻辑比较混乱,想要放弃了,感觉自己非常没用.昨天跟豆聊了一下,否定自己是一点意义也没有的,觉得自己很差劲,无助的感觉跟初 ...

  8. 获取真实ip的报告

    今天登录九秒社团 http://www.9miao.com/的时候忘记了用户名和密码,尝试了5次都没登录成功,网站弹出提示15分钟后才能再次登录.我纳闷它是怎么判断用户的登录次数,这时候用户还没有登录 ...

  9. 移动设备优先viewport

    Bootstrap 3 的设计目标是移动设备优先,然后才是桌面设备.这实际上是一个非常及时的转变,因为现在越来越多的用户使用移动设备. 为了让 Bootstrap 开发的网站对移动设备友好,确保适当的 ...

  10. java System.out

    从写Hello World开始,我们就开始使用System.out了.System.out是一个static final 的PrintStream对象. 引用一段jdk API document的内容 ...