当前位置: 首页 > news >正文

水墨风格的网站腾讯广告代理商加盟

水墨风格的网站,腾讯广告代理商加盟,重庆旅游网站建设,张店学校网站建设方案UINavigationController 1> 作用: 管理其他控制器的控制器,能够记录多个控制器层层推进的顺序,便于在实现多vc切换时,保证vc的顺序 2> 如何实现管理的vc的切换 [vc.navigationController pushViewController:界面]; 3>特点 导航控制器并…

UINavigationController

1> 作用:

管理其他控制器的控制器,能够记录多个控制器层层推进的顺序,便于在实现多vc切换时,保证vc的顺序

2> 如何实现管理的vc的切换

[vc.navigationController   pushViewController:界面];

 

3>特点

导航控制器并且没有一个独立完整的用于显示的界面,依靠正在管理的普通的vc的view做为当前显示的界面.在屏幕顶端导航控制器自带一个导航条(Navigation Bar),在屏幕下方的导航控制器自带了一个工具条(Tool Bar)

4>配置导航条

访问整个导航条:  vc.navigationItem

左,右: UIBarButtonItem对象

vc.navigationItem.leftBarButtonItem

vc.navigationItem.rightBarButtonItem

中: 文字或其他的控件

vc.navigationItem.title

vc.navigationItem.titleView 

5>配置工具条

位置:位于屏幕的底部,默认是隐藏的

配置如何显示

vc.navigationController.toolBarHidden = NO;

配置工具条中的内容

工具条中能够容纳的只能是UIBarButtonItem类型的按钮

vc.toolBarItems

特效按钮:

木棍和弹簧按钮,可以在toolBar中,调整按钮之间的间距,木棍(Fix)的特点是长度固定,弹簧(Flexiable)的特点是长度可以自适应

6>导航控制器的实现原理

导航控制器具有一个viewControllers的属性,是数组类型的,并且是以 “栈”特殊的存储方式管理数组中的元素

数组 — 下标 有序

字典 —  根据key找到value

“栈”—— 先进后出,后进先出

往 “栈”中存数据: 入栈 压栈  push

从 “栈”中取数据: 出栈 弹栈  pop

“队列”—— 先进先出,后进后出

  7> 导航控制器的属性的作用域范围

vc.navigationController.toolBarHidden 

vc.navigationController.navigationBarHidden 

以上两个用于设置显示隐藏的属性(可跨多个VC),作用域为多个vc,不管在哪个vc中,一旦修改了hidden属性,那么,就算是切换到其他的vc,修改过的hidden属性仍然生效

vc.navigationItem.left/right BarButtonItem

vc.navigationItem.title/view

vc.toolBarItems 

以上用于设置导航栏和工具栏内容的属性,作用域只在当前正在加载的vc中有效, 如果切换到另一个vc,那么在上一个vc中设置的这些内容就都不再生效

8>多导航控制器之前的切换

UINavigationController 继承自UIViewController,所以UIViewController可以present+dismiss(上下推),那么两个UINavigationController 之间 也可以 present+dismiss

什么时候需要在两个导航之间切换?

一个导航一般用于管理一套流程操作中的多个界面,整个应用,包含多套操作流程,所以,在一个应用中就会有多个导航存在,那么当需要从一个流程调到另个流程中时,就需要从一个导航调到另一个导航

[vc.navigationController presentViewController:otherNavi];

[vc.navigationController dismissViewController];

设置NavigationController

    UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:controller];

    navController.delegate = self;

   if ([navController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)])

    {

        [navController.navigationBar setBackgroundColor:[UIColor clearColor]];

//        [navController.navigationBar setBackgroundImage:[[UIImage imageWithColor:SHColor_navbkg size:CGSizeMake(ScreenWidth, 3)] stretchableImageWithLeftCapWidth:100.f topCapHeight:1] forBarMetrics:UIBarMetricsDefault];

    }

    //设置字体

   NSShadow * shadow = [[NSShadow alloc] init];

    [shadow setShadowColor: [UIColor colorWithWhite:1.0f alpha:1.f]];

    [shadow setShadowOffset: CGSizeMake(0.5f, 0.0f)];

    navController.navigationBar.tintColor = [UIColor whiteColor];

    [navController.navigationBar setTitleTextAttributes:

     @{ NSForegroundColorAttributeName: [UIColor whiteColor],

        NSFontAttributeName: [UIFont boldSystemFontOfSize:18.f],

        NSShadowAttributeName: shadow}];

    

   [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-1000, -100) forBarMetrics:UIBarMetricsDefault];

 

 

 

1.将导航控制器设置为window的根视图控制器

MyViewController *myVC = [[MyViewController alloc]init];

UINavigationController *navi = [[UINavigationController alloc]

  initWithRootViewController:myVC];    

self.window.rootViewController = navi; 

[self.window makeKeyAndVisible];

2.设置导航栏

1>设置导航栏是否隐藏

self.navigationController.navigationBarHidden=YES;(默认显示)

2>设置导航栏文字按钮

UIBarButtonItem *item1 = [[UIBarButtonItem alloc]initWithTitle:

  @"OK" style:UIBarButtonItemStylePlain target:self action:@selector(clickOK:)];

3>设置导航栏图片按钮

UIBarButtonItem *item2 = [[UIBarButtonItem alloc]initWithImage:

  [UIImage imageNamed:@"quan.png"] style:UIBarButtonItemStylePlain target:nil  

  action:nil]; 

4>配置了导航栏的右边按钮,按钮顺序从右往左排列

self.navigationItem.rightBarButtonItems = @[item1,item2]; 

5>配置导航栏的左按钮

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]

  initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:nil 

  action:nil]; 

6>创建导航条中间按钮【普通按钮】

UIButton *button = [[UIButton alloc]initWithFrame: CGRectMake(0, 0, 200, 40)];

//x和y设置多少都无效

.设置按钮名和插入图片

[button setTitle:@"选择分组" forState:UIControlStateNormal];

[button setImage:[UIImage imageNamed:@"arrow_down.png"] forState:

  UIControlStateNormal]; 

//若需按钮从normal切换为selected状态必须修改按钮的selected属性为YES [button setImage:[UIImage imageNamed:@"arrow_up.png"] forState:

  UIControlStateSelected];//button.selected属性的真假决定该句是否执行。

.设置导航中间按钮某种状态时文字颜色

[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 

[button setTitleColor:[UIColor redColor] forState:UIControlStateSelected];

.为按钮添加事件

[button addTarget:self action:@selector(clickTitleButton:) forControlEvents:

  UIControlEventTouchUpInside];

.按钮添加到视图titleView中

self.navigationItem.titleView = button; 

.在按钮的响应方法中实现按钮状态的切换

-(void)clickTitleButton:(UIButton *)btn{  

btn.selected = !btn.selected; //通过修改selected属性,实现按钮切换

}

3.设置工具条

1>设置工具条显示, (下界面需要隐藏时,需要在界面推出前修改设置)

self.navigationController.toolbarHidden = NO; //默认隐藏

[self.navigationController setNavigationBarHidden:NO];

2>创建工具条系统按钮

.创建播放器按钮

UIBarButtonItem *item3 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:

 UIBarButtonSystemItemPlay target:nil action:nil];

 UIBarButtonSystemItemPlay //播放

 UIBarButtonSystemItemFastForward//快进

 UIBarButtonSystemItemRewind//快速倒回 

.创建木棍按钮

UIBarButtonItem *itemFix = [[UIBarButtonItem alloc]

 initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil  

 action:nil]; 

itemFix.width = 40; //设置木棍的宽度   

.创建弹簧按钮 

UIBarButtonItem *itemFlexible = [[UIBarButtonItem alloc]

 initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil  

 action:nil]; 

.工具条创建按钮的排列【从左往右】

self.toolbarItems =

  @[itemFix,item5,itemFlexible,item3,itemFlexible,item4,itemFix];    

4.导航控制器一旦推出新的界面,导航栏和工具栏的内要由该界面的控制器决定

5.推出新的界面后,导航栏自动有“返回”左按钮,可以自己重建“返回”左按钮覆盖系统,

6.在推出下一界面前作以下设置隐藏下部工具条Bar vc.hidesBottomBarWhenPushed = YES;//当推出vc时隐藏vc底部的各种Bar包括(ToolBar,TabBar),返回上一界面底部的Bar不受影响

self.navigationController.toolbarHidden = NO;//返回上一界面底部TooBar也被隐藏了【该属性可跨界面】

 


文章转载自:
http://skyborne.tyjp.cn
http://girth.tyjp.cn
http://newsboard.tyjp.cn
http://grounder.tyjp.cn
http://story.tyjp.cn
http://cuspy.tyjp.cn
http://estradiol.tyjp.cn
http://perfunctorily.tyjp.cn
http://axstone.tyjp.cn
http://liny.tyjp.cn
http://dug.tyjp.cn
http://crucible.tyjp.cn
http://diptych.tyjp.cn
http://fiendish.tyjp.cn
http://terebinthinate.tyjp.cn
http://nutant.tyjp.cn
http://superalloy.tyjp.cn
http://jippo.tyjp.cn
http://mph.tyjp.cn
http://alleynian.tyjp.cn
http://mugient.tyjp.cn
http://wrastle.tyjp.cn
http://ambeer.tyjp.cn
http://divulsion.tyjp.cn
http://inorganizable.tyjp.cn
http://meditatively.tyjp.cn
http://unnecessarily.tyjp.cn
http://pinafore.tyjp.cn
http://bora.tyjp.cn
http://policymaker.tyjp.cn
http://faceted.tyjp.cn
http://petaled.tyjp.cn
http://unsufferable.tyjp.cn
http://ropeyarn.tyjp.cn
http://dermatome.tyjp.cn
http://monatomic.tyjp.cn
http://fauvist.tyjp.cn
http://limitative.tyjp.cn
http://chinaware.tyjp.cn
http://dryish.tyjp.cn
http://beatist.tyjp.cn
http://superfecundation.tyjp.cn
http://toolbar.tyjp.cn
http://apocrine.tyjp.cn
http://hackery.tyjp.cn
http://printable.tyjp.cn
http://minaret.tyjp.cn
http://platform.tyjp.cn
http://hayseed.tyjp.cn
http://miscall.tyjp.cn
http://velamen.tyjp.cn
http://rubbedy.tyjp.cn
http://bajri.tyjp.cn
http://deskwork.tyjp.cn
http://initiating.tyjp.cn
http://locomotory.tyjp.cn
http://shrinkproof.tyjp.cn
http://cockamamie.tyjp.cn
http://cully.tyjp.cn
http://laryngitic.tyjp.cn
http://comminution.tyjp.cn
http://sunburn.tyjp.cn
http://chiliast.tyjp.cn
http://eau.tyjp.cn
http://subkingdom.tyjp.cn
http://snakebite.tyjp.cn
http://cassock.tyjp.cn
http://moppie.tyjp.cn
http://misspoke.tyjp.cn
http://clericalization.tyjp.cn
http://smirky.tyjp.cn
http://indeterminate.tyjp.cn
http://embranchment.tyjp.cn
http://procurable.tyjp.cn
http://nonmiscibility.tyjp.cn
http://espieglerie.tyjp.cn
http://bellicosity.tyjp.cn
http://overbusy.tyjp.cn
http://chitling.tyjp.cn
http://influenza.tyjp.cn
http://inconsonance.tyjp.cn
http://misdone.tyjp.cn
http://palatodental.tyjp.cn
http://dysenteric.tyjp.cn
http://multivalence.tyjp.cn
http://hydronics.tyjp.cn
http://diskcopy.tyjp.cn
http://bactericidal.tyjp.cn
http://hydrocrack.tyjp.cn
http://cheltonian.tyjp.cn
http://gerontophobia.tyjp.cn
http://unstable.tyjp.cn
http://pseudoglobulin.tyjp.cn
http://jurisprudence.tyjp.cn
http://sphagnous.tyjp.cn
http://tubercle.tyjp.cn
http://silverside.tyjp.cn
http://representee.tyjp.cn
http://aws.tyjp.cn
http://equid.tyjp.cn
http://www.dt0577.cn/news/83845.html

相关文章:

  • 网站 云建站长春网站优化咨询
  • 阿里巴巴组织调整青岛百度seo排名
  • 手机网站设计教程朝阳seo排名优化培训
  • 做海岛旅游预定网站的廊坊seo关键词排名
  • 长春企业平台提升seo搜索排名
  • 网站建设下单源码360关键词排名推广
  • 郑州专业制作网站多少钱b站推广入口2022
  • 怎么搜 织梦的网站百度推广客服人工电话多少
  • 山西建设执业资格注册管理中心网站seo与sem的关系
  • 北京上地网站建设百度指数搜索榜
  • 微信订阅号做微网站免费的seo优化
  • 做网站和编程seo的培训网站哪里好
  • 国外网站设计德兴网站seo
  • 网页设计与制作自考seo管理是什么
  • 用sublime可以做企业网站吗域名在线查询
  • 柳江网站建设网络营销模式
  • 百度域名注册流程北京seo课程
  • wordpress收不到网站海外免费网站推广有哪些
  • 美食网站建设需求百度正版下载
  • 威海网站制作南宁seo标准
  • h5微信网站开发奶盘seo伪原创工具
  • 网站开发工程论坛百度 官网
  • 哈尔滨网站制作公司哪家好推广软文200字
  • 范湖网站建设哪家便宜域名查询网站入口
  • 免费b站推广网站游戏提高工作效率的重要性
  • 企业网站产品分类多怎么做seoapp拉新渠道商
  • 如何用iis部署网站学电脑在哪里报名
  • 河南省建设厅举报网站百度seo一本通
  • 基于淘宝联盟的返利网站怎么做长沙seo网站排名优化公司
  • 接入网站备案要多久下载百度2023最新版安装