When entering the new version, push and guide the new version

Source: Internet
Author: User

When entering the new version, push and guide the new version

Xx Effect

 

The Code is as follows: first create the XMGPushGuideView class XMGPushGuideView. h file # import <UIKit/UIKit. h>

@ Interface XMGPushGuideView: UIView
/** Load xib */
+ (Instancetype) guideView;
/** Judge the current version number and determine whether to load the recommendation boot page */
+ (Void) show;
@ End XMGPushGuideView. m file # 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 = @ "cfbundlepolicversionstring ";

// Obtain the current software version
NSString * currentVersion = [NSBundle mainBundle]. infoDictionary [key];

// Obtain the storage version number in the sandbox.
NSString * sanboxVersion = [[NSUserDefaults standardUserDefaults] stringForKey: key];

If (! [CurrentVersion is1_tostring: sanboxVersion]) {

// Obtain the current window
UIWindow * window = [UIApplication sharedApplication]. keyWindow;


XMGPushGuideView * guideView = [XMGPushGuideView guideView];
GuideView. frame = window. bounds;
[Window addSubview: guideView];
// Storage version number
[[NSUserDefaults standardUserDefaults] setObject: currentVersion forKey: key];
// Store the version number in the sandbox immediately
[[NSUserDefaults standardUserDefaults] synchronize];
}

}
@ End and in the AppDelegate. m file-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {
// Override point for customization after application launch.

// Create a window
Self. window = [[UIWindow alloc] init];
Self. window. frame = [UIScreen mainScreen]. bounds;

// Set the Controller for the window
Self. window. rootViewController = [[XMGTabBarController alloc] init];


// Display window
[Self. window makeKeyAndVisible];



// Display push Guide
[XMGPushGuideView show];


Return YES ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.