├── README.md └── SureGuideView ├── SureGuideView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── liushuo.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── liushuo.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── SureGuideView.xcscheme │ └── xcschememanagement.plist └── SureGuideView ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── PrefixHeader.pch ├── SureGuideView ├── SureGuideView.h ├── SureGuideView.m ├── UIImage+Adaptive.h └── UIImage+Adaptive.m ├── ViewController.h ├── ViewController.m ├── main.m └── resource ├── guide_1_iphone4@2x.png ├── guide_1_iphone5@2x.png ├── guide_1_iphone6@2x.png ├── guide_1_iphone6p@2x.png ├── guide_2_iphone4@2x.png ├── guide_2_iphone5@2x.png ├── guide_2_iphone6@2x.png └── guide_2_iphone6p@2x.png /README.md: -------------------------------------------------------------------------------- 1 | # SureGuideView 2 | ######内容源由 3 | 每当项目更新,对于新功能的使用通常会给予用户以蒙版引导提示。 4 | 5 | 为避免繁琐无用的操作,可将该功能模块进行封装。下面分享自己封装流程,可作为[自定义控件封装思路](http://www.jianshu.com/p/53895b673038)的后续,旨在帮助封装程度较低的朋友们。 6 | 7 | ![引导示例,图来自网络.png](http://upload-images.jianshu.io/upload_images/1767950-508c0f5d9bb27dcb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 8 | 9 | 考虑需求,为了更方便处理,引导图的命名通常具有一定规则,例如:guide_1、guide_2等,但因需要屏幕适配,设计会依次提供3.5、4、4.7、5.5寸的效果图,也就是说每张图片需要对应四种屏幕尺寸。所以在真实的项目开发中,需要适配的图片命名通常为guide_1_iphone5、guide_1_iphone6、guide_1_iphone6p等。 10 | 11 | 对于此需求我们可以为UIImage添加类别,当```UIImage```调用```imageAdaptiveNamed```方法时对应添加设备标示,代码如下: 12 | ``` 13 | + (instancetype)imageAdaptiveNamed:(NSString*)imagename { 14 | NSString *realImageName = imagename; 15 | //当前设备为iphone4/4S 16 | if (IS_iPHONE4) { 17 | realImageName = [NSString stringWithFormat:@"%@_iphone4",realImageName]; 18 | } 19 | //当前设备为iphone5/5S 20 | if (IS_iPHONE5) { 21 | realImageName = [NSString stringWithFormat:@"%@_iphone5",realImageName]; 22 | } 23 | //当前设备为iphone6/6S/7 24 | if (IS_iPHONE6) { 25 | realImageName = [NSString stringWithFormat:@"%@_iphone6",realImageName]; 26 | } 27 | //当前设备为iphone6P/6SP/7P 28 | if (IS_iPHONE6P) { 29 | realImageName = [NSString stringWithFormat:@"%@_iphone6p",realImageName]; 30 | } 31 | return [self imageNamed:realImageName]; 32 | } 33 | ``` 34 | 对于设备的判断推荐使用**[UIDevice currentDevice].mode**,比如 35 | ``` 36 | #define IS_iPHONE6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(750, 1334),[[UIScreen mainScreen] currentMode].size)): NO) 37 | ``` 38 | 接下来创建继承于UIView的自定义类,这里希望外漏方法,使调用该方法的程序员只需传递引导蒙版图片的通用名字和图片个数即可。 39 | 40 | 首先想到的是这样的一个方法,在自定义View的init基础上进行扩展参数,如下: 41 | ``` 42 | - (instancetype)initWithImageName:(NSString*)imageName 43 | imageCount:(NSInteger)imageCount; 44 | ``` 45 | 但是还不够好,对应自定义类要让调用的人使用起来更简洁,因此我们会将此方法转化为类方法 46 | ``` 47 | + (instancetype)sureGuideViewWithImageName:(NSString*)imageName 48 | imageCount:(NSInteger)imageCount; 49 | ``` 50 | 对应的实现如下,这里为了图片通用名称与图片个数可全局使用,因此声明为属性。 51 | ``` 52 | //蒙版图片通用名称,如guide 53 | @property (nonatomic, copy) NSString *imageName; 54 | //蒙版图片个数 55 | @property (nonatomic, assign) NSInteger imageCount; 56 | ``` 57 | ``` 58 | //需外漏的方法 59 | + (instancetype)sureGuideViewWithImageName:(NSString*)imageName 60 | imageCount:(NSInteger)imageCount{ 61 | return [[self alloc]initWithImageName:imageName imageCount:imageCount]; 62 | } 63 | //初始化操作 64 | - (instancetype)initWithImageName:(NSString*)imageName 65 | imageCount:(NSInteger)imageCount{ 66 | if (self = [super init]) { 67 | _imageName = imageName; 68 | _imageCount = imageCount; 69 | [self createUI]; 70 | } 71 | return self; 72 | } 73 | ``` 74 | 接下来即为将对应的图片创建即可。 75 | ``` 76 | - (void)createUI { 77 | self.backgroundColor = [UIColor clearColor]; 78 | self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); 79 | if (_imageCount) { 80 | for (NSInteger i = 0; i < _imageCount; i++) { 81 | NSString *realImageName = [NSString stringWithFormat:@"%@_%ld",_imageName,i + 1]; 82 | UIImage *image = [UIImage imageAdaptiveNamed:realImageName]; 83 | UIImageView *imageView = [[UIImageView alloc]initWithImage:image]; 84 | imageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); 85 | imageView.userInteractionEnabled = YES; 86 | imageView.tag = 1000 + i; 87 | [self addSubview:imageView]; 88 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(touchImageView:)]; 89 | [imageView addGestureRecognizer:tap]; 90 | } 91 | } 92 | [self show]; 93 | } 94 | ``` 95 | 经过如上操作,即可将所传入的蒙版图片通用名称进行更改,例如guide->guide_1_iphone6等,若需在最后一张点击后进行事件处理,可以通过Block或代理进行回调。 96 | ``` 97 | - (void)touchImageView:(UITapGestureRecognizer*)tap { 98 | UIImageView *tapImageView = (UIImageView*)tap.view; 99 | //依次移除 100 | [tapImageView removeFromSuperview]; 101 | if (tapImageView.tag - 1000 == 0) { 102 | //最后一张 103 | if (self.lastTapBlock) { 104 | self.lastTapBlock(); 105 | } 106 | [self hide]; 107 | } 108 | } 109 | ``` 110 | 最后即为控制其显隐性的问题了,对于引导界面,通常是加载到UIWindow上,而非视图控制器,分别声明show与hide方法。 111 | ``` 112 | //显示 113 | - (void)show { 114 | [UIApplication sharedApplication].statusBarHidden = YES; 115 | AppDelegate *appDel = (AppDelegate*)[UIApplication sharedApplication].delegate; 116 | [appDel.window addSubview:self]; 117 | } 118 | ``` 119 | ``` 120 | //隐藏 121 | - (void)hide { 122 | [UIApplication sharedApplication].statusBarHidden = NO; 123 | [self removeFromSuperview]; 124 | } 125 | ``` 126 | 对于引导蒙版的显示,通常为用户第一次进入App显示,因此我们可以简单的通过```NSUserDefaults ```实现该操作。 127 | 分别在.h.m中外漏参数 128 | ``` 129 | //.h 130 | extern NSString *const SureShouldShowGuide; 131 | //.m 132 | NSString *const SureShouldShowGuide = @"SureShouldShowGuide"; 133 | ``` 134 | 这一点可以在[为什么要尽量避免使用宏定义](http://www.jianshu.com/p/81f83934ea83)中得知,也是方便其他人快速上手的原因。 135 | ``` 136 | //是否显示引导页面 137 | + (BOOL)shouldShowGuider { 138 | NSNumber *number = [[NSUserDefaults standardUserDefaults]objectForKey:SureShouldShowGuide]; 139 | if ([number isEqual:@200]) {//若有值存在,不显示 140 | return NO; 141 | } else {//值不存在,显示并赋值 142 | [[NSUserDefaults standardUserDefaults]setObject:@200 forKey:SureShouldShowGuide]; 143 | [[NSUserDefaults standardUserDefaults]synchronize]; 144 | return YES; 145 | } 146 | } 147 | ``` 148 | 至此,我们所需要的蒙版引导页面封装完毕。调用也十分简洁: 149 | ``` 150 | //判断是否显示引导页面 151 | if ([SureGuideView shouldShowGuider]) { 152 | //展示 153 | [SureGuideView sureGuideViewWithImageName:@"guide" imageCount:3]; 154 | } 155 | ``` 156 | 此例较基础,但作为封装思路的理解还是有所益处的,希望对大家有所帮助! 157 | 158 | ######demo下载链接 159 | [一劳永逸,iOS引导蒙版封装流程demo🔗](https://github.com/LSure/SureGuideView) 160 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8839B8391DE5344E0042F572 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8839B8381DE5344E0042F572 /* main.m */; }; 11 | 8839B83C1DE5344E0042F572 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8839B83B1DE5344E0042F572 /* AppDelegate.m */; }; 12 | 8839B83F1DE5344E0042F572 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8839B83E1DE5344E0042F572 /* ViewController.m */; }; 13 | 8839B8421DE5344E0042F572 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8839B8401DE5344E0042F572 /* Main.storyboard */; }; 14 | 8839B8441DE5344E0042F572 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8839B8431DE5344E0042F572 /* Assets.xcassets */; }; 15 | 8839B8471DE5344E0042F572 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8839B8451DE5344E0042F572 /* LaunchScreen.storyboard */; }; 16 | 8839B8531DE5347B0042F572 /* SureGuideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8839B8501DE5347B0042F572 /* SureGuideView.m */; }; 17 | 8839B8541DE5347B0042F572 /* UIImage+Adaptive.m in Sources */ = {isa = PBXBuildFile; fileRef = 8839B8521DE5347B0042F572 /* UIImage+Adaptive.m */; }; 18 | 88AA02761DE53A5B00736532 /* guide_1_iphone4@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA026E1DE53A5B00736532 /* guide_1_iphone4@2x.png */; }; 19 | 88AA02771DE53A5B00736532 /* guide_1_iphone5@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA026F1DE53A5B00736532 /* guide_1_iphone5@2x.png */; }; 20 | 88AA02781DE53A5B00736532 /* guide_1_iphone6@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA02701DE53A5B00736532 /* guide_1_iphone6@2x.png */; }; 21 | 88AA02791DE53A5B00736532 /* guide_1_iphone6p@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA02711DE53A5B00736532 /* guide_1_iphone6p@2x.png */; }; 22 | 88AA027A1DE53A5B00736532 /* guide_2_iphone4@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA02721DE53A5B00736532 /* guide_2_iphone4@2x.png */; }; 23 | 88AA027B1DE53A5B00736532 /* guide_2_iphone5@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA02731DE53A5B00736532 /* guide_2_iphone5@2x.png */; }; 24 | 88AA027C1DE53A5B00736532 /* guide_2_iphone6@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA02741DE53A5B00736532 /* guide_2_iphone6@2x.png */; }; 25 | 88AA027D1DE53A5B00736532 /* guide_2_iphone6p@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 88AA02751DE53A5B00736532 /* guide_2_iphone6p@2x.png */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 8839B8341DE5344E0042F572 /* SureGuideView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SureGuideView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 8839B8381DE5344E0042F572 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 31 | 8839B83A1DE5344E0042F572 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 32 | 8839B83B1DE5344E0042F572 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 33 | 8839B83D1DE5344E0042F572 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 34 | 8839B83E1DE5344E0042F572 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 35 | 8839B8411DE5344E0042F572 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 36 | 8839B8431DE5344E0042F572 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 37 | 8839B8461DE5344E0042F572 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 38 | 8839B8481DE5344E0042F572 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | 8839B84F1DE5347B0042F572 /* SureGuideView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SureGuideView.h; sourceTree = ""; }; 40 | 8839B8501DE5347B0042F572 /* SureGuideView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SureGuideView.m; sourceTree = ""; }; 41 | 8839B8511DE5347B0042F572 /* UIImage+Adaptive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Adaptive.h"; sourceTree = ""; }; 42 | 8839B8521DE5347B0042F572 /* UIImage+Adaptive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Adaptive.m"; sourceTree = ""; }; 43 | 8839B8561DE534C20042F572 /* PrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; 44 | 88AA026E1DE53A5B00736532 /* guide_1_iphone4@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_1_iphone4@2x.png"; sourceTree = ""; }; 45 | 88AA026F1DE53A5B00736532 /* guide_1_iphone5@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_1_iphone5@2x.png"; sourceTree = ""; }; 46 | 88AA02701DE53A5B00736532 /* guide_1_iphone6@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_1_iphone6@2x.png"; sourceTree = ""; }; 47 | 88AA02711DE53A5B00736532 /* guide_1_iphone6p@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_1_iphone6p@2x.png"; sourceTree = ""; }; 48 | 88AA02721DE53A5B00736532 /* guide_2_iphone4@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_2_iphone4@2x.png"; sourceTree = ""; }; 49 | 88AA02731DE53A5B00736532 /* guide_2_iphone5@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_2_iphone5@2x.png"; sourceTree = ""; }; 50 | 88AA02741DE53A5B00736532 /* guide_2_iphone6@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_2_iphone6@2x.png"; sourceTree = ""; }; 51 | 88AA02751DE53A5B00736532 /* guide_2_iphone6p@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_2_iphone6p@2x.png"; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 8839B8311DE5344E0042F572 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 8839B82B1DE5344E0042F572 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 8839B8361DE5344E0042F572 /* SureGuideView */, 69 | 8839B8351DE5344E0042F572 /* Products */, 70 | ); 71 | sourceTree = ""; 72 | }; 73 | 8839B8351DE5344E0042F572 /* Products */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 8839B8341DE5344E0042F572 /* SureGuideView.app */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 8839B8361DE5344E0042F572 /* SureGuideView */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 8839B8571DE537770042F572 /* resource */, 85 | 8839B84E1DE5347B0042F572 /* SureGuideView */, 86 | 8839B83A1DE5344E0042F572 /* AppDelegate.h */, 87 | 8839B83B1DE5344E0042F572 /* AppDelegate.m */, 88 | 8839B83D1DE5344E0042F572 /* ViewController.h */, 89 | 8839B83E1DE5344E0042F572 /* ViewController.m */, 90 | 8839B8561DE534C20042F572 /* PrefixHeader.pch */, 91 | 8839B8401DE5344E0042F572 /* Main.storyboard */, 92 | 8839B8431DE5344E0042F572 /* Assets.xcassets */, 93 | 8839B8451DE5344E0042F572 /* LaunchScreen.storyboard */, 94 | 8839B8481DE5344E0042F572 /* Info.plist */, 95 | 8839B8371DE5344E0042F572 /* Supporting Files */, 96 | ); 97 | path = SureGuideView; 98 | sourceTree = ""; 99 | }; 100 | 8839B8371DE5344E0042F572 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 8839B8381DE5344E0042F572 /* main.m */, 104 | ); 105 | name = "Supporting Files"; 106 | sourceTree = ""; 107 | }; 108 | 8839B84E1DE5347B0042F572 /* SureGuideView */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 8839B84F1DE5347B0042F572 /* SureGuideView.h */, 112 | 8839B8501DE5347B0042F572 /* SureGuideView.m */, 113 | 8839B8511DE5347B0042F572 /* UIImage+Adaptive.h */, 114 | 8839B8521DE5347B0042F572 /* UIImage+Adaptive.m */, 115 | ); 116 | path = SureGuideView; 117 | sourceTree = ""; 118 | }; 119 | 8839B8571DE537770042F572 /* resource */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 88AA026E1DE53A5B00736532 /* guide_1_iphone4@2x.png */, 123 | 88AA026F1DE53A5B00736532 /* guide_1_iphone5@2x.png */, 124 | 88AA02701DE53A5B00736532 /* guide_1_iphone6@2x.png */, 125 | 88AA02711DE53A5B00736532 /* guide_1_iphone6p@2x.png */, 126 | 88AA02721DE53A5B00736532 /* guide_2_iphone4@2x.png */, 127 | 88AA02731DE53A5B00736532 /* guide_2_iphone5@2x.png */, 128 | 88AA02741DE53A5B00736532 /* guide_2_iphone6@2x.png */, 129 | 88AA02751DE53A5B00736532 /* guide_2_iphone6p@2x.png */, 130 | ); 131 | path = resource; 132 | sourceTree = ""; 133 | }; 134 | /* End PBXGroup section */ 135 | 136 | /* Begin PBXNativeTarget section */ 137 | 8839B8331DE5344E0042F572 /* SureGuideView */ = { 138 | isa = PBXNativeTarget; 139 | buildConfigurationList = 8839B84B1DE5344E0042F572 /* Build configuration list for PBXNativeTarget "SureGuideView" */; 140 | buildPhases = ( 141 | 8839B8301DE5344E0042F572 /* Sources */, 142 | 8839B8311DE5344E0042F572 /* Frameworks */, 143 | 8839B8321DE5344E0042F572 /* Resources */, 144 | ); 145 | buildRules = ( 146 | ); 147 | dependencies = ( 148 | ); 149 | name = SureGuideView; 150 | productName = SureGuideView; 151 | productReference = 8839B8341DE5344E0042F572 /* SureGuideView.app */; 152 | productType = "com.apple.product-type.application"; 153 | }; 154 | /* End PBXNativeTarget section */ 155 | 156 | /* Begin PBXProject section */ 157 | 8839B82C1DE5344E0042F572 /* Project object */ = { 158 | isa = PBXProject; 159 | attributes = { 160 | LastUpgradeCheck = 0800; 161 | ORGANIZATIONNAME = "刘硕"; 162 | TargetAttributes = { 163 | 8839B8331DE5344E0042F572 = { 164 | CreatedOnToolsVersion = 8.0; 165 | DevelopmentTeam = 735QGT93G2; 166 | ProvisioningStyle = Automatic; 167 | }; 168 | }; 169 | }; 170 | buildConfigurationList = 8839B82F1DE5344E0042F572 /* Build configuration list for PBXProject "SureGuideView" */; 171 | compatibilityVersion = "Xcode 3.2"; 172 | developmentRegion = English; 173 | hasScannedForEncodings = 0; 174 | knownRegions = ( 175 | en, 176 | Base, 177 | ); 178 | mainGroup = 8839B82B1DE5344E0042F572; 179 | productRefGroup = 8839B8351DE5344E0042F572 /* Products */; 180 | projectDirPath = ""; 181 | projectRoot = ""; 182 | targets = ( 183 | 8839B8331DE5344E0042F572 /* SureGuideView */, 184 | ); 185 | }; 186 | /* End PBXProject section */ 187 | 188 | /* Begin PBXResourcesBuildPhase section */ 189 | 8839B8321DE5344E0042F572 /* Resources */ = { 190 | isa = PBXResourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | 88AA027B1DE53A5B00736532 /* guide_2_iphone5@2x.png in Resources */, 194 | 88AA027A1DE53A5B00736532 /* guide_2_iphone4@2x.png in Resources */, 195 | 88AA02771DE53A5B00736532 /* guide_1_iphone5@2x.png in Resources */, 196 | 8839B8471DE5344E0042F572 /* LaunchScreen.storyboard in Resources */, 197 | 88AA027D1DE53A5B00736532 /* guide_2_iphone6p@2x.png in Resources */, 198 | 8839B8441DE5344E0042F572 /* Assets.xcassets in Resources */, 199 | 8839B8421DE5344E0042F572 /* Main.storyboard in Resources */, 200 | 88AA02761DE53A5B00736532 /* guide_1_iphone4@2x.png in Resources */, 201 | 88AA02781DE53A5B00736532 /* guide_1_iphone6@2x.png in Resources */, 202 | 88AA027C1DE53A5B00736532 /* guide_2_iphone6@2x.png in Resources */, 203 | 88AA02791DE53A5B00736532 /* guide_1_iphone6p@2x.png in Resources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXResourcesBuildPhase section */ 208 | 209 | /* Begin PBXSourcesBuildPhase section */ 210 | 8839B8301DE5344E0042F572 /* Sources */ = { 211 | isa = PBXSourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | 8839B83F1DE5344E0042F572 /* ViewController.m in Sources */, 215 | 8839B83C1DE5344E0042F572 /* AppDelegate.m in Sources */, 216 | 8839B8541DE5347B0042F572 /* UIImage+Adaptive.m in Sources */, 217 | 8839B8531DE5347B0042F572 /* SureGuideView.m in Sources */, 218 | 8839B8391DE5344E0042F572 /* main.m in Sources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXSourcesBuildPhase section */ 223 | 224 | /* Begin PBXVariantGroup section */ 225 | 8839B8401DE5344E0042F572 /* Main.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | 8839B8411DE5344E0042F572 /* Base */, 229 | ); 230 | name = Main.storyboard; 231 | sourceTree = ""; 232 | }; 233 | 8839B8451DE5344E0042F572 /* LaunchScreen.storyboard */ = { 234 | isa = PBXVariantGroup; 235 | children = ( 236 | 8839B8461DE5344E0042F572 /* Base */, 237 | ); 238 | name = LaunchScreen.storyboard; 239 | sourceTree = ""; 240 | }; 241 | /* End PBXVariantGroup section */ 242 | 243 | /* Begin XCBuildConfiguration section */ 244 | 8839B8491DE5344E0042F572 /* Debug */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_ANALYZER_NONNULL = YES; 249 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 250 | CLANG_CXX_LIBRARY = "libc++"; 251 | CLANG_ENABLE_MODULES = YES; 252 | CLANG_ENABLE_OBJC_ARC = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 256 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 257 | CLANG_WARN_EMPTY_BODY = YES; 258 | CLANG_WARN_ENUM_CONVERSION = YES; 259 | CLANG_WARN_INFINITE_RECURSION = YES; 260 | CLANG_WARN_INT_CONVERSION = YES; 261 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 262 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 266 | COPY_PHASE_STRIP = NO; 267 | DEBUG_INFORMATION_FORMAT = dwarf; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | ENABLE_TESTABILITY = YES; 270 | GCC_C_LANGUAGE_STANDARD = gnu99; 271 | GCC_DYNAMIC_NO_PIC = NO; 272 | GCC_NO_COMMON_BLOCKS = YES; 273 | GCC_OPTIMIZATION_LEVEL = 0; 274 | GCC_PREPROCESSOR_DEFINITIONS = ( 275 | "DEBUG=1", 276 | "$(inherited)", 277 | ); 278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 285 | MTL_ENABLE_DEBUG_INFO = YES; 286 | ONLY_ACTIVE_ARCH = YES; 287 | SDKROOT = iphoneos; 288 | }; 289 | name = Debug; 290 | }; 291 | 8839B84A1DE5344E0042F572 /* Release */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ALWAYS_SEARCH_USER_PATHS = NO; 295 | CLANG_ANALYZER_NONNULL = YES; 296 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 297 | CLANG_CXX_LIBRARY = "libc++"; 298 | CLANG_ENABLE_MODULES = YES; 299 | CLANG_ENABLE_OBJC_ARC = YES; 300 | CLANG_WARN_BOOL_CONVERSION = YES; 301 | CLANG_WARN_CONSTANT_CONVERSION = YES; 302 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 303 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 304 | CLANG_WARN_EMPTY_BODY = YES; 305 | CLANG_WARN_ENUM_CONVERSION = YES; 306 | CLANG_WARN_INFINITE_RECURSION = YES; 307 | CLANG_WARN_INT_CONVERSION = YES; 308 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 309 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 310 | CLANG_WARN_UNREACHABLE_CODE = YES; 311 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 312 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 313 | COPY_PHASE_STRIP = NO; 314 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 315 | ENABLE_NS_ASSERTIONS = NO; 316 | ENABLE_STRICT_OBJC_MSGSEND = YES; 317 | GCC_C_LANGUAGE_STANDARD = gnu99; 318 | GCC_NO_COMMON_BLOCKS = YES; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 326 | MTL_ENABLE_DEBUG_INFO = NO; 327 | SDKROOT = iphoneos; 328 | VALIDATE_PRODUCT = YES; 329 | }; 330 | name = Release; 331 | }; 332 | 8839B84C1DE5344E0042F572 /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | buildSettings = { 335 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 336 | DEVELOPMENT_TEAM = 735QGT93G2; 337 | GCC_PREFIX_HEADER = "$(SRCROOT)/SureGuideView/PrefixHeader.pch"; 338 | INFOPLIST_FILE = SureGuideView/Info.plist; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 340 | PRODUCT_BUNDLE_IDENTIFIER = com.yongche.sure.SureGuideView; 341 | PRODUCT_NAME = "$(TARGET_NAME)"; 342 | }; 343 | name = Debug; 344 | }; 345 | 8839B84D1DE5344E0042F572 /* Release */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 349 | DEVELOPMENT_TEAM = 735QGT93G2; 350 | GCC_PREFIX_HEADER = "$(SRCROOT)/SureGuideView/PrefixHeader.pch"; 351 | INFOPLIST_FILE = SureGuideView/Info.plist; 352 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 353 | PRODUCT_BUNDLE_IDENTIFIER = com.yongche.sure.SureGuideView; 354 | PRODUCT_NAME = "$(TARGET_NAME)"; 355 | }; 356 | name = Release; 357 | }; 358 | /* End XCBuildConfiguration section */ 359 | 360 | /* Begin XCConfigurationList section */ 361 | 8839B82F1DE5344E0042F572 /* Build configuration list for PBXProject "SureGuideView" */ = { 362 | isa = XCConfigurationList; 363 | buildConfigurations = ( 364 | 8839B8491DE5344E0042F572 /* Debug */, 365 | 8839B84A1DE5344E0042F572 /* Release */, 366 | ); 367 | defaultConfigurationIsVisible = 0; 368 | defaultConfigurationName = Release; 369 | }; 370 | 8839B84B1DE5344E0042F572 /* Build configuration list for PBXNativeTarget "SureGuideView" */ = { 371 | isa = XCConfigurationList; 372 | buildConfigurations = ( 373 | 8839B84C1DE5344E0042F572 /* Debug */, 374 | 8839B84D1DE5344E0042F572 /* Release */, 375 | ); 376 | defaultConfigurationIsVisible = 0; 377 | defaultConfigurationName = Release; 378 | }; 379 | /* End XCConfigurationList section */ 380 | }; 381 | rootObject = 8839B82C1DE5344E0042F572 /* Project object */; 382 | } 383 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView.xcodeproj/project.xcworkspace/xcuserdata/liushuo.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView.xcodeproj/project.xcworkspace/xcuserdata/liushuo.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SureGuideView/SureGuideView.xcodeproj/xcuserdata/liushuo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView.xcodeproj/xcuserdata/liushuo.xcuserdatad/xcschemes/SureGuideView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView.xcodeproj/xcuserdata/liushuo.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SureGuideView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 8839B8331DE5344E0042F572 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SureGuideView 4 | // 5 | // Created by 刘硕 on 2016/11/23. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SureGuideView 4 | // 5 | // Created by 刘硕 on 2016/11/23. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | #import "SureGuideView.h" 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; 22 | self.window.backgroundColor = [UIColor whiteColor]; 23 | self.window.rootViewController = [[ViewController alloc]init]; 24 | [self.window makeKeyAndVisible]; 25 | 26 | if ([SureGuideView shouldShowGuider]) { 27 | [SureGuideView sureGuideViewWithImageName:@"guide" imageCount:2]; 28 | } 29 | return YES; 30 | } 31 | 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application { 34 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 35 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 36 | } 37 | 38 | 39 | - (void)applicationDidEnterBackground:(UIApplication *)application { 40 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 41 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 42 | } 43 | 44 | 45 | - (void)applicationWillEnterForeground:(UIApplication *)application { 46 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 47 | } 48 | 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application { 51 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 52 | } 53 | 54 | 55 | - (void)applicationWillTerminate:(UIApplication *)application { 56 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 57 | } 58 | 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UIViewControllerBasedStatusBarAppearance 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // SureGuideView 4 | // 5 | // Created by 刘硕 on 2016/11/23. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #ifndef PrefixHeader_pch 10 | #define PrefixHeader_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width 15 | #define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height 16 | 17 | #endif /* PrefixHeader_pch */ 18 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/SureGuideView/SureGuideView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SureGuideView.h 3 | // ProjectRefactoring 4 | // 5 | // Created by 刘硕 on 2016/11/17. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *const SureShouldShowGuide; 12 | 13 | @interface SureGuideView : UIView 14 | 15 | @property (nonatomic, copy) void(^lastTapBlock)(void); 16 | 17 | + (instancetype)sureGuideViewWithImageName:(NSString*)imageName 18 | imageCount:(NSInteger)imageCount; 19 | 20 | + (BOOL)shouldShowGuider; 21 | 22 | - (void)show; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/SureGuideView/SureGuideView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SureGuideView.m 3 | // ProjectRefactoring 4 | // 5 | // Created by 刘硕 on 2016/11/17. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import "SureGuideView.h" 10 | #import "UIImage+Adaptive.h" 11 | #import "AppDelegate.h" 12 | NSString *const SureShouldShowGuide = @"SureShouldShowGuide"; 13 | @interface SureGuideView () 14 | @property (nonatomic, copy) NSString *imageName; 15 | @property (nonatomic, assign) NSInteger imageCount; 16 | @end 17 | @implementation SureGuideView 18 | 19 | + (instancetype)sureGuideViewWithImageName:(NSString*)imageName 20 | imageCount:(NSInteger)imageCount{ 21 | return [[self alloc]initWithImageName:imageName imageCount:imageCount]; 22 | } 23 | 24 | - (instancetype)initWithImageName:(NSString*)imageName 25 | imageCount:(NSInteger)imageCount{ 26 | if (self = [super init]) { 27 | _imageName = imageName; 28 | _imageCount = imageCount; 29 | [self createUI]; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)createUI { 35 | self.backgroundColor = [UIColor clearColor]; 36 | self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); 37 | if (_imageCount) { 38 | for (NSInteger i = 0; i < _imageCount; i++) { 39 | NSString *realImageName = [NSString stringWithFormat:@"%@_%ld",_imageName,i + 1]; 40 | UIImage *image = [UIImage imageAdaptiveNamed:realImageName]; 41 | UIImageView *imageView = [[UIImageView alloc]initWithImage:image]; 42 | imageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); 43 | imageView.userInteractionEnabled = YES; 44 | imageView.tag = 1000 + i; 45 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(touchImageView:)]; 46 | [imageView addGestureRecognizer:tap]; 47 | [self addSubview:imageView]; 48 | } 49 | } 50 | [self show]; 51 | } 52 | 53 | - (void)touchImageView:(UITapGestureRecognizer*)tap { 54 | UIImageView *tapImageView = (UIImageView*)tap.view; 55 | //依次移除 56 | [tapImageView removeFromSuperview]; 57 | if (tapImageView.tag - 1000 == 0) { 58 | //最后一张 59 | if (self.lastTapBlock) { 60 | self.lastTapBlock(); 61 | } 62 | [self hide]; 63 | } 64 | } 65 | 66 | - (void)show { 67 | [UIApplication sharedApplication].statusBarHidden = YES; 68 | AppDelegate *appDel = (AppDelegate*)[UIApplication sharedApplication].delegate; 69 | [appDel.window addSubview:self]; 70 | } 71 | 72 | - (void)hide { 73 | [UIApplication sharedApplication].statusBarHidden = NO; 74 | [self removeFromSuperview]; 75 | } 76 | 77 | + (BOOL)shouldShowGuider { 78 | NSNumber *number = [[NSUserDefaults standardUserDefaults]objectForKey:SureShouldShowGuide]; 79 | if ([number isEqual:@200]) { 80 | return NO; 81 | } else { 82 | [[NSUserDefaults standardUserDefaults]setObject:@200 forKey:SureShouldShowGuide]; 83 | [[NSUserDefaults standardUserDefaults]synchronize]; 84 | return YES; 85 | } 86 | } 87 | /* 88 | // Only override drawRect: if you perform custom drawing. 89 | // An empty implementation adversely affects performance during animation. 90 | - (void)drawRect:(CGRect)rect { 91 | // Drawing code 92 | } 93 | */ 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/SureGuideView/UIImage+Adaptive.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Adaptive.h 3 | // ProjectRefactoring 4 | // 5 | // Created by 刘硕 on 2016/11/17. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (Adaptive) 12 | 13 | + (instancetype)imageAdaptiveNamed:(NSString*)imagename; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/SureGuideView/UIImage+Adaptive.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Adaptive.m 3 | // ProjectRefactoring 4 | // 5 | // Created by 刘硕 on 2016/11/17. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import "UIImage+Adaptive.h" 10 | #define IS_iPHONE4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960),[[UIScreen mainScreen] currentMode].size): NO) 11 | #define IS_iPHONE5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136),[[UIScreen mainScreen] currentMode].size): NO) 12 | #define IS_iPHONE6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(750, 1334),[[UIScreen mainScreen] currentMode].size)): NO) 13 | #define IS_iPHONE6P ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1242, 2208),[[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1125, 2001),[[UIScreen mainScreen] currentMode].size)): NO) 14 | @implementation UIImage (Adaptive) 15 | 16 | + (instancetype)imageAdaptiveNamed:(NSString*)imagename { 17 | NSString *realImageName = imagename; 18 | //当前设备为iphone4/4S 19 | if (IS_iPHONE4) { 20 | realImageName = [NSString stringWithFormat:@"%@_iphone4",realImageName]; 21 | } 22 | //当前设备为iphone5/5S 23 | if (IS_iPHONE5) { 24 | realImageName = [NSString stringWithFormat:@"%@_iphone5",realImageName]; 25 | } 26 | //当前设备为iphone6/6S/7 27 | if (IS_iPHONE6) { 28 | realImageName = [NSString stringWithFormat:@"%@_iphone6",realImageName]; 29 | } 30 | //当前设备为iphone6P/6SP/7P 31 | if (IS_iPHONE6P) { 32 | realImageName = [NSString stringWithFormat:@"%@_iphone6p",realImageName]; 33 | } 34 | return [self imageNamed:realImageName]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SureGuideView 4 | // 5 | // Created by 刘硕 on 2016/11/23. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SureGuideView 4 | // 5 | // Created by 刘硕 on 2016/11/23. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | @interface ViewController () 11 | 12 | @end 13 | 14 | @implementation ViewController 15 | 16 | - (void)viewDidLoad { 17 | [super viewDidLoad]; 18 | // Do any additional setup after loading the view, typically from a nib. 19 | self.view.backgroundColor = [UIColor lightGrayColor]; 20 | } 21 | 22 | - (void)viewDidAppear:(BOOL)animated { 23 | [super viewDidAppear:animated]; 24 | 25 | } 26 | 27 | 28 | - (void)didReceiveMemoryWarning { 29 | [super didReceiveMemoryWarning]; 30 | // Dispose of any resources that can be recreated. 31 | } 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SureGuideView 4 | // 5 | // Created by 刘硕 on 2016/11/23. 6 | // Copyright © 2016年 刘硕. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_1_iphone4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_1_iphone4@2x.png -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_1_iphone5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_1_iphone5@2x.png -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_1_iphone6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_1_iphone6@2x.png -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_1_iphone6p@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_1_iphone6p@2x.png -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_2_iphone4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_2_iphone4@2x.png -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_2_iphone5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_2_iphone5@2x.png -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_2_iphone6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_2_iphone6@2x.png -------------------------------------------------------------------------------- /SureGuideView/SureGuideView/resource/guide_2_iphone6p@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LSure/SureGuideView/8b283a74331982a5c84d59c5e3d518e023d352f7/SureGuideView/SureGuideView/resource/guide_2_iphone6p@2x.png --------------------------------------------------------------------------------