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 ;}