XX effect
The specific code is as follows first create a new Xmgpushguideview class XMGPushGuideView.h file #import <UIKit/UIKit.h>
@interface Xmgpushguideview:uiview
/** Loading Xib */
+ (instancetype) Guideview;
/** judge the current version number, and determine whether to load the recommended 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 *[email protected] "cfbundleshortversionstring";
Get the version number of the current software
NSString *currentversion = [NSBundle Mainbundle].infodictionary[key];
Get the version number of the store in the sandbox
NSString *sanboxversion=[[nsuserdefaults Standarduserdefaults] stringforkey:key];
if (![ CurrentVersion Isequaltostring:sanboxversion]) {
Get the current window
UIWindow *window=[uiapplication Sharedapplication].keywindow;
Xmgpushguideview *guideview=[xmgpushguideview Guideview];
Guideview.frame=window.bounds;
[Window Addsubview:guideview];
Store version number
[[Nsuserdefaults Standarduserdefaults] setobject:currentversion Forkey:key];
Store the version number in the sandbox now
[[Nsuserdefaults standarduserdefaults] synchronize];
}
}
@end while in APPDELEGATE.M file-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (NSDictionary *) Launchoptions {
Override point for customization after application launch.
Create window
Self.window=[[uiwindow Alloc]init];
Self.window.frame=[uiscreen Mainscreen].bounds;
Setting the window's heel controller
Self.window.rootviewcontroller=[[xmgtabbarcontroller Alloc]init];
Display window
[Self.window makekeyandvisible];
Show Push Boot
[Xmgpushguideview show];
return YES;}
Push-to-boot when entering a new version