星空网 > 软件开发 > 操作系统

在进入新版本 的时候,进行推送引导

xx效果

在进入新版本 的时候,进行推送引导images/loading.gif' data-original="http://images2015.cnblogs.com/blog/818241/201605/818241-20160526084358491-213958211.gif" />

 

具体代码如下
首先新建XMGPushGuideView类
 
XMGPushGuideView.h 文件
 
#import <UIKit/UIKit.h>

@interface XMGPushGuideView : UIView
/** 加载xib */
+(instancetype)guideView;
/** 判断当前的版本号,确定是加载推荐引导页 */
+(void)show;

@end
 
 
 
XMGPushGuideView.m 文件
 
#import "XMGPushGuideView.h"

@implementation XMGPushGuideView

+(instancetype)guideView{

    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
}
- (IBAction)close {
    [self removeFromSuperview];
}

+(void)show{
   
    NSString *key=@"CFBundleShortVersionString";
   
    // 获得当前软件的版本号
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];
   
    //    获得沙盒中的存储的版本号
    NSString *sanboxVersion=[[NSUserDefaults standardUserDefaults] stringForKey:key];
   
    if (![currentVersion isEqualToString:sanboxVersion]) {
       
//        获得当前的window
        UIWindow *window=[UIApplication sharedApplication].keyWindow;

       
        XMGPushGuideView *guideView=[XMGPushGuideView guideView];
        guideView.frame=window.bounds;
        [window addSubview:guideView];
        //        存储版本号
        [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:key];
        //       马上把版本号存储到沙盒中
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
   
}
@end
 
 
而在AppDelegate.m文件
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
   
//    创建窗口
    self.window=[[UIWindow alloc]init];
    self.window.frame=[UIScreen mainScreen].bounds;
   
//    设置窗口的跟控制器
     self.window.rootViewController=[[XMGTabBarController alloc]init];

   
//    显示窗口
    [self.window makeKeyAndVisible];
   


//    显示推送引导
    [XMGPushGuideView show];
   
   
    return YES;
}
 
 
 
在进入新版本 的时候,进行推送引导
 
 



原标题:在进入新版本 的时候,进行推送引导

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

寄到马来西亚邮寄:https://www.goluckyvip.com/tag/91044.html
邮寄寄到马来西亚:https://www.goluckyvip.com/tag/91045.html
快运寄马来西亚运费:https://www.goluckyvip.com/tag/91046.html
马来西亚速递:https://www.goluckyvip.com/tag/91047.html
速递马来西亚:https://www.goluckyvip.com/tag/91048.html
马来西亚寄快递到新加坡:https://www.goluckyvip.com/tag/91049.html
商机!速卖通推出小B采销节,挖掘机、莫桑钻、电动车近期在海外走俏!:https://www.xlkjsw.com/news/93297.html
Zalando对欧盟在线平台监管费提出质疑:https://www.kjdsnews.com/a/1842241.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流