zoukankan      html  css  js  c++  java
  • 【Objective-C学习记录】第四十二天

    UINavigationController(导航视图控制器)

    导航视图控制器也是一个视图控制器,它管理了多个子视图控制器,当使用导航视图控制器进行布局时,需要指定window的根视图控制器为导航视图控制器。

    1.initWithRootViewController:。初始化方法,传入一个根视图控制器。

    2.navigationBar.barStyle。通过属性设置导航栏的样式。

    3.navigationBar.backgroundColor。通过属性设置导航栏的背景颜色。

    4.navigationBar.barTintColor。通过属性设置导航栏的颜色。

    5.navigationBar.tintColor。通过属性设置导航栏元素的颜色。

    6.navigationController.navigationBarHidden。设置导航栏的显隐属性

    7.navigationController.navigationBar.translucent。设置导航栏是否开启半透明效果,在iOS 7以后默认为YES,当半透明效果开启时,屏幕左上角为坐标原点,关闭时,导航栏左下角为坐标原点

    navigationItem

    每一个加到导航试图控制器内部的视图控制器都会带有一个叫做navigationItem的属性,通过该属性可以配置当前页面导航条的显示内容,比如左、右按钮,标题等。

    1.navigationItem.leftBarButtonItem。通过属性为导航栏设置左按钮。

    2.navigationItem.leftBarButtonItems。通过属性为导航栏设置多个左按钮。

    3.navigationItem.titleView。通过属性为导航栏设置标题视图

    UIBarButtonItem(导航栏按钮)

    1.initWithTitle: style: target: action:。使用默认图标样式

    2.initWithBarButtonSystemItem: target: action:。使用系统内部图标样式

    3.initWithImage: style: target: action:。使用自定义图片

    4.initWithCustomView:。使用自定义视图

    导航栏视图控制器之间的切换方式主要有推出(push)和模态(present)两种方式。

    推出(push)用于一系列的视图之间的跳转,有层次递进关系。

    模态(present)用于单独功能页面(主要业务逻辑没有关联)的跳转。

    通过点击按钮实现推出视图控制器的操作。步骤如下:

    1 //1.创建想要跳转到的视图控制器
    2 MyViewController *myVC = [[MyViewController alloc] init];
    3 //2.导航栏视图控制器完成推出操作
    4 [self.navigationController pushViewController:myVC animated:YES];
    5 //3.释放内存
    6 [myVC release];

    通过点击按钮返回到某一级视图控制器。步骤如下:

    1 //1.返回到上一级视图控制器
    2 [self.navigationController popViewControllerAnimated:YES];
    3 //2.返回根视图控制器
    4 [self.navigationController popToRootViewControllerAnimated:YES];
    5 //3.返回到指定的的视图控制器
    6 UIViewController *vc = [self.navigationController.viewControllers objectAtIndex:1];
    7 [self.navigationController popToViewController:vc animated:YES];

    模态

    1 MyViewController *myVC = [[MyViewController alloc] init];
    2 UINavigationController *naVC = [[UINavigationController alloc] initWithRootViewController:myVC];
    3 naVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    4 [self.navigationController presentViewController:naVC animated:YES completion:nil];

    UIScrollView(滚动视图)

    1.initWithFrame:。初始化方法

    2.contentSize。滚动区域的大小

    3.contentOffset。滚动视图偏移量

    4.pagingEnable。整页滚动

    5.showHorizontalScrollIndicator。设置横向滚动条是否显示

    6.bounces。设置回弹效果是否关闭,默认是开启的

    7.zoomScale。设置当前比例

    8.minimunZoomScale。最小缩放比例

    9.maximumZoomScale。最大缩放比例

    10.scrollViewDidScroll:。滚动过程中触发的方法

    11.scrollViewWillBeginDragging:。即将开始拖拽的方法,此时滚动视图即将进行加速

    12.scrollViewDidEndDragging:。结束拖拽的方法,不再加速

    13.scrollViewWillBeginDecelerating:。即将开始减速

    14.scrollViewDidEndDecelerating:。结束减速,也就是停止滚动

    缩放功能

    如果想实现滚动视图的缩放功能,必须指定缩放的视图以及缩放的比例。并且指定缩放视图需要实现代理方法,指定缩放比例。

    UIPageControl

    1.initWithFrame:。初始化方法

    2.numberOfPages。设置页数

    3.currentPage。设置当前显示第几页

    懒加载

    1 - (UILabel *)label {
    2     if (label == nil) {
    3         _label = [[UILabel alloc] initWithFrame:CGRectMake(100,100,100,100)];
    4         return _label;
    5     }
    6     return _label;
    7 } 
  • 相关阅读:
    ORA12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
    ORACLE MERGE 介绍
    【转】三大UML建模工具Visio、Rational Rose、PowerDesign的区别
    ORALC的STDDEV、STDDEV_POP、STDDEV_SAMP等函数
    SQL语言艺术实践篇——局外思考
    数据分析方法
    ORACLE FLASHBACK TABLE 的一个有趣问题
    avalon有关ViewModel与Model的同步问题
    迷你MVVM框架 avalonjs 0.73发布
    将一个节点集合以最少的步骤转换为另一个节点集合
  • 原文地址:https://www.cnblogs.com/shvier/p/5127926.html
Copyright © 2011-2022 走看看