zoukankan      html  css  js  c++  java
  • 引导页实现代码--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中实现控件布局

  • 相关阅读:
    MySQL 幻读详解
    vue-layer 弹窗z-index问题
    vue-cli 路径不变 改变参数 显示不同组件
    mysql ---- limit使用方式
    mysql ---- 官网的测试数据库
    2020年度总结和2021年目标
    校招(春招实习 + 秋招)总结感想
    Centos8和7的区别(参照redhat)
    centos8 网卡命令(centos7也可用)
    排查linux系统是否被入侵
  • 原文地址:https://www.cnblogs.com/PJXWang/p/5854743.html
Copyright © 2011-2022 走看看