#import <UIKit/UIKit.h>

#define TOPVIEWTAG 0x10000  // 导航栏的图片

@interface UIViewController (Chnbs)

-(void)setupTopNavigationView;
-(void)resizeNavigationView; -(CGRect)CGRectMake; -(void)showMessage:(NSString*)message; @en
======================
@implementation UIViewController (Chnbs) -(void)setupTopNavigationView{
self.navigationController.navigationBarHidden = YES;
UIView *tpNavView = [[UIView alloc] initWithFrame:CGRectMake(, , self.view.bounds.size.width, )];
tpNavView.tag = TOPVIEWTAG;
[self.view addSubview:tpNavView];
[tpNavView release]; UIImageView *navImageView = [UIImageView ImageViewImageName:@"top_navigation_image.png" frame:tpNavView.bounds];
navImageView.tag = ;
[tpNavView addSubview:navImageView]; UILabel *label = [UILabel LabWithFrame:tpNavView.bounds text:self.title textColor:[UIColor whiteColor] textAlign:NSTextAlignmentCenter font:[UIFont boldSystemFontOfSize:]];
[tpNavView addSubview:label];
label.tag=;
UIButton *back = [UIButton ButtonWithImageName:@"btn_back_image.png" hImageName:@"btn_back_image.png" frame:CGRectMake(, , , )
title:nil titleColor:nil font:nil target:self action:@selector(backButtonAction:)];
back.tag = 0x404;
[tpNavView addSubview:back]; //FIX 添加导航的屏幕自动适配
tpNavView.autoresizingMask=UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleWidth;
navImageView.autoresizingMask=UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleWidth;
label.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin;
} -(void)resizeNavigationView{
UIView *topView = ASDynamicCast(UIView, [self.view viewWithTag:TOPVIEWTAG]);
topView.frame = CGRectMake(, , self.view.bounds.size.width, ); UIImageView *image = ASDynamicCast(UIImageView, [topView viewWithTag:]);
image.frame = topView.bounds;
UILabel *tLab = ASDynamicCast(UILabel, [topView viewWithTag:]);
tLab.frame = topView.bounds; UIButton *back = ASDynamicCast(UIButton, [topView viewWithTag:0x404]);
back.frame = CGRectMake(, , , );
} -(void)backButtonAction:(id)sender{
[self.navigationController popViewControllerAnimated:YES];
} -(CGRect)CGRectMake{
CGRect topViewRec,bottonViewRec;
CGRectDivide(self.view.bounds, &topViewRec, &bottonViewRec, , CGRectMinYEdge);
return bottonViewRec;
} -(void)showMessage:(NSString*)message{
if ([message length] > ) {
UIAlertView *av = [[UIAlertView alloc] initWithTitle:nil message:message delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[av show];
[av release];
} } @end

ios 中UIViewController的分类的更多相关文章

  1. 转iOS中delegate、protocol的关系

    iOS中delegate.protocol的关系 分类: iOS Development2014-02-12 10:47 277人阅读 评论(0) 收藏 举报 delegateiosprocotolc ...

  2. IOS中KVO模式的解析与应用

    IOS中KVO模式的解析与应用 最近老翁在项目中多处用到了KVO,深感这种模式的好处.现总结如下: 一.概述 KVO,即:Key-Value Observing,它提供一种机制,当指定的对象的属性被修 ...

  3. iOS 中的 HotFix 方案总结详解

    相信HotFix大家应该都很熟悉了,今天主要对于最近调研的一些方案做一些总结.iOS中的HotFix方案大致可以分为四种: WaxPatch(Alibaba) Dynamic Framework(Ap ...

  4. 谈谈iOS中的锁

    1 前言 近日工作不是太忙,刚好有时间了解一些其他东西,本来打算今天上午去体检,但是看看天气还是明天再去吧,也有很大一个原因:就是周六没有预约上!闲话少说,这里简单对锁来个简单介绍分享. 2 目录 第 ...

  5. iOS开发——高级篇——iOS中常见的设计模式(MVC/单例/委托/观察者)

    关于设计模式这个问题,在网上也找过一些资料,下面是我自己总结的,分享给大家 如果你刚接触设计模式,我们有好消息告诉你!首先,多亏了Cocoa的构建方式,你已经使用了许多的设计模式以及被鼓励的最佳实践. ...

  6. 1.0 iOS中的事件

    本文并非最终版本,如有更新或更正会第一时间置顶,联系方式详见文末 如果觉得本文内容过长,请前往本人 “简书”   在用户使用app过程中,会产生各种各样的事件,iOS中的事件可以分为3大类型: UIK ...

  7. iOS:iOS中的多控制器管理

    iOS中的控制器有三种创建方式: 1.通过storyboard创建 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@" ...

  8. Cordoval在iOS中的运用整理

    一:关于Cordoval理论知识 1:PhoneGap是手机平台上流行的一款中间件.它构建在各种手机平台所提供的WebView(浏览器内核)组件的基础之上,使用javascript语言对应用开发者提供 ...

  9. iOS中的触摸事件和手势处理

    iOS中的事件可以分为三大类: 1> 触摸事件 2> 加速计事件 3> 远程控制事件 响应者对象 在iOS中不是任何对象都能处理事件,只有继承了UIResponder的对象才能接收并 ...

随机推荐

  1. C#中的枚举(Enum)你知道多少呢?

    写个随笔文章是最难想的,我要是写个C#枚举个人小结,估计博客园的各位园有也觉得是哪个刚接触C#的人写的,要是取个名字叫C#枚举,又觉得不能完全表达自己的意思,现在这个名字看起来还凑合吧,写篇文章不容易 ...

  2. 文件 File 常见操作 工具 MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  3. 说说最易被忽略的CSS强制性换行

    一般情况下,元素拥有默认的white-space:normal(自动换行,PS:不换行是white-space:nowrap),当录入的文字超过定义的宽度后会自动换行,但当录入的数据是一堆没有空格的字 ...

  4. Nginx如何启用ETag,提高访问速度

    ETag全称EntityTags,HTTP协议规格说明中定义“ETag”为“被请求变量的实体值”. 我们也可以把ETag理解为是一个客户端与服务器关联的记号.这个记号告诉客户端,当前网页在上次请求之后 ...

  5. Laravel 5 中使用 JWT(Json Web Token) 实现基于API的用户认证

    在JavaScript前端技术大行其道的今天,我们通常只需在后台构建API提供给前端调用,并且后端仅仅设计为给前端移动App调用.用户认证是Web应用的重要组成部分,基于API的用户认证有两个最佳解决 ...

  6. NLP领域的ImageNet时代到来:词嵌入「已死」,语言模型当立

    http://3g.163.com/all/article/DM995J240511AQHO.html 选自the Gradient 作者:Sebastian Ruder 机器之心编译 计算机视觉领域 ...

  7. Centos安装gcc及g++

    Centos支持yum安装,安装软件一般格式为yum install .......,注意安装时要先成为root用户. 按照这个思路,我想安装过程如下: 安装gcc:yum install gcc 安 ...

  8. Get file extention in XSLT

      When working with data view web parts or data form web parts in SharePoint, you might want to use ...

  9. GLFW_KEY_KP_ADD和GLFW_KEY_KP_SUBTRACT

      这两个键的代码分别为: GLFW_KEY_KP_ADD(334) GLFW_KEY_KP_SUBTRACT(333)   对应的是键盘右侧数字面板上的+ -键.

  10. GPUImage API文档之GPUImageContext类

    GPUImageContext类,提供OpenGL ES基本环境,我们一般不会用到,所以讲的很简单. 属性 @property(readonly, nonatomic) dispatch_queue_ ...