首页 > 移动平台 > 详细

引导页实现代码--iOS

时间:2016-09-08 23:16:15      阅读:184      评论:0      收藏:0      [点我收藏+]

 

@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中实现控件布局

引导页实现代码--iOS

原文:http://www.cnblogs.com/PJXWang/p/5854743.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!