• 引导页总结


    Page类

    继承于NSObject,保存每个page的信息,如各种图片、文字、标题内容等。

    @interface EAIntroPage : NSObject
    
    // title image Y position - from top of the screen
    // title and description labels Y position - from bottom of the screen
    @property (nonatomic, retain) UIImage *bgImage;
    @property (nonatomic, retain) UIImage *titleImage;
    @property (nonatomic, assign) CGFloat imgPositionY;
    @property (nonatomic, retain) NSString *title;
    @property (nonatomic, retain) UIFont *titleFont;
    @property (nonatomic, retain) UIColor *titleColor;
    @property (nonatomic, assign) CGFloat titlePositionY;
    @property (nonatomic, retain) NSString *desc;
    @property (nonatomic, retain) UIFont *descFont;
    @property (nonatomic, retain) UIColor *descColor;
    @property (nonatomic, assign) CGFloat descPositionY;
    
    // if customView is set - all other properties are ignored
    @property (nonatomic, retain) UIView *customView;
    
    + (EAIntroPage *)page;
    + (EAIntroPage *)pageWithCustomView:(UIView *)customV;
    
    @end
    

    View类的subViews

    1.UIImageView *bgImageView

    最底层,背景图片,初始化为clearColor。

        self.bgImageView = [[UIImageView alloc] initWithFrame:self.frame];
        self.bgImageView.backgroundColor = [UIColor clearColor];
        self.bgImageView.contentMode = UIViewContentModeScaleToFill;
        self.bgImageView.autoresizesSubviews = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        self.bgImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        [self addSubview:self.bgImageView];

    如果不需要修改每个page的背景图片,每个page使用相同的背景图片,则只需要设置此VIEW的image,不需要设置pageBgBack和PageBgFront。

    2.UIImageView *pageBgFront,pageBgBack

    初始化同上。front在上,back在下,分别代表当前page的背景和下一page的背景,。初始化时候分别为0页和1页。

    这两个imageView位置不变,始终显示在当前屏幕上,在页面切换的时候调整它们的alpha值,达到背景平滑切换的效果。

    如果背景为纯色,则背景颜色平滑过度到目标颜色;如果背景为图片,则上面的图片渐渐隐藏的同时下面的图片渐渐显现。

        [self.pageBgFront setAlpha:1];
        [self.pageBgFront setImage:[self bgForPage:page]];
        [self.pageBgBack setAlpha:0];
        [self.pageBgBack setImage:[self bgForPage:page+1]];
        
        float backLayerAlpha = alphaValue;
        float frontLayerAlpha = (1 - alphaValue);
        
        [self.pageBgBack setAlpha:backLayerAlpha];
        [self.pageBgFront setAlpha:frontLayerAlpha];
    

     其中,page的值为:

    float offset = scrollView.contentOffset.x / self.scrollView.frame.size.width;
    
    3.UIScrollView *scrollView  NSMutableArray *pageViews
    4.UIView *titleView;
     
  • 相关阅读:
    Java 如何将 List 转换为 MAP
    Spring Batch BATCH_JOB_INSTANCE 表不存在错误
    Spring 项目启动测试的时候错误:Unable to acquire JDBC Connection
    Spring JPA 如何进行无参数查询布尔类型
    Spring 数据处理中的事务级别
    Spring 测试运行的时候提示 Unable to find a @SpringBootConfiguration 错误
    Spring Batch 可以在一个 Step 中有多个 Tasklet 吗
    Java 属性文件乱码问题
    Spring JPA 查询的时候提示错 org.hibernate.TransientObjectException
    Spring Batch 事务限制
  • 原文地址:https://www.cnblogs.com/zhongriqianqian/p/4000852.html
Copyright © 2020-2023  润新知