• 引导页实现代码--iOS


    @interface PJXPushGuideView : UIView

    +(instancetype)guideView;

    +(void)show;

    @end

    #import "PJXPushGuideView.h"

    @implementation PJXPushGuideView

    +(instancetype)guideView{

        //加载xib

        PJXPushGuideView *guideView = [[[NSBundle mainBundle]loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];

        guideView.backgroundColor = [UIColor colorWithRed:49.0/255.0 green:49.0/255.0  blue:49.0/255.0  alpha:0.75];

        return guideView;

    }

    - (IBAction)remove:(id)sender {

        [self removeFromSuperview];

    }

    +(void)show

    {

        NSDictionary *info = [[NSBundle mainBundle]infoDictionary];

        NSString *key = @"CFBundleShortVersionString";

        NSString * currentVersion = [info objectForKey:key];

        NSString *sanboxVersion = [[NSUserDefaults standardUserDefaults] stringForKey:key];

        if (![currentVersion isEqualToString:sanboxVersion]) {

            PJXPushGuideView *pushView = [PJXPushGuideView guideView];

            pushView.frame = [UIApplication sharedApplication].keyWindow.bounds;

            [[UIApplication sharedApplication].keyWindow addSubview:pushView];

            [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:key];

            [[NSUserDefaults standardUserDefaults] synchronize];

            

        }

    }

    @end

     然后在PJXPushGuideView.xib中实现控件布局

  • 相关阅读:
    微服务定义及.Net Core中用的技术
    IPad分屏,当电脑第二显示屏
    .net Core1.0 邮件发送
    AutoMapper总结
    02-C#(基础)基本的定义和说明
    01-.Net编程机制
    C#基础篇--静态成员、抽象成员、接口
    C#基础篇--面向对象(类与对象)
    期末总结
    改动后的封装
  • 原文地址:https://www.cnblogs.com/PJXWang/p/5854743.html
Copyright © 2020-2023  润新知