zoukankan      html  css  js  c++  java
  • ScrollView与UIPageController

    1.UIEdgeInsets contentInset ;内边距,相当于把内容放大了,在内容本身加了一圈外边距。

    CGPoint contentoffset;当UIScrollerView内部的内容滚动时,内容相对于UIScrollView在左上角的偏移值。

    2,如果ScollView里面的视图到处飘,在Viewdidload里面加上:

    self.automaticallyAdjustsScrollViewInsets = NO;

    automaticallyAdjustsScrollViewInsets根据按所在界面的status bar,navigationbar,与tabbar的高度,自动调整scrollview的 inset,设置为no,不让viewController调整,我们自己修改布局即可

    3,其他属性:Bool bounce;弹簧效果

    BOOL scrollEnabled;是否能滚动;

    self.scrollView.showHorizontalScrollIndicator = YES;

    self.scrollView.showVerticalScrollIndicator = YES;显示横向/纵向进度条

    self.pagingEnabled = YES;

    4,实现缩放图片步骤:

    1. 添加UIScrollView 设置大小。添加控件UIImageView,设置大小;
    2. 设置代理,服从代理协议;
    3. 实现方法,返回要缩放放的子控件,在viewdidLoad里设置缩放比例:self.scrollView.maxmumZoomScale,self.scrollView.minmumZoomScale;

    5,图片轮播器案列:

    1,添加UIScrollView.2,动态添加图片框(横向)3,设置UIScrollView的contentSize实现滚动,4,实现分页,UIPageControl,5,设置NSTime定时滚动,

     6,[self.scrollView bringSubViewTofront:self.pageControl];将空间设置到最上面。

    7,UIPageController基本属性:

    self.PicCtr = [[UIPageControl alloc]initWithFrame:CGRectMake((self.PicScrollView.width-150)/2, self.PicScrollView.y+200-40, 150, 30)];
        _PicCtr.pageIndicatorTintColor = [UIColor grayColor];
        _PicCtr.currentPageIndicatorTintColor = [UIColor redColor];
        _PicCtr.numberOfPages = 5;
        _PicCtr.currentPage = 0;
        [self.view addSubview:_PicCtr];
        [self.view bringSubviewToFront:_PicCtr];
    

     只有一页时,是否隐藏页码指示器:bool hidesForSinglePage;

  • 相关阅读:
    Doubles
    The 3n + 1 problem
    Counterfeit Dollar
    Maya Calendar
    08_python的列表、元祖、字符串、字典及公共方法
    07_python的函数
    06_python的while语句
    05_python的if语句
    04_python基本的输入输出函数
    03_python的数据类型和变量的定义及使用
  • 原文地址:https://www.cnblogs.com/yangqinglong/p/5533481.html
Copyright © 2011-2022 走看看