diff --git a/ZYGLaunchIntroductionDemo/LaunchIntroduction/LaunchIntroductionView.m b/ZYGLaunchIntroductionDemo/LaunchIntroduction/LaunchIntroductionView.m index 85b7041..73fa11f 100644 --- a/ZYGLaunchIntroductionDemo/LaunchIntroduction/LaunchIntroductionView.m +++ b/ZYGLaunchIntroductionDemo/LaunchIntroduction/LaunchIntroductionView.m @@ -23,14 +23,13 @@ @implementation LaunchIntroductionView BOOL isScrollOut;//在最后一页再次滑动是否隐藏引导页 CGRect enterBtnFrame; NSString *enterBtnImage; -static LaunchIntroductionView *launch = nil; NSString *storyboard; #pragma mark - 创建对象-->>不带button +(instancetype)sharedWithImages:(NSArray *)imageNames{ images = imageNames; isScrollOut = YES; - launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; + LaunchIntroductionView *launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; launch.backgroundColor = [UIColor whiteColor]; return launch; } @@ -41,7 +40,7 @@ +(instancetype)sharedWithImages:(NSArray *)imageNames buttonImage:(NSString *)bu isScrollOut = NO; enterBtnFrame = frame; enterBtnImage = buttonImageName; - launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; + LaunchIntroductionView *launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; launch.backgroundColor = [UIColor whiteColor]; return launch; } @@ -50,7 +49,7 @@ + (instancetype)sharedWithStoryboardName:(NSString *)storyboardName images:(NSAr images = imageNames; storyboard = storyboardName; isScrollOut = YES; - launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; + LaunchIntroductionView *launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; launch.backgroundColor = [UIColor whiteColor]; return launch; } @@ -61,7 +60,7 @@ + (instancetype)sharedWithStoryboard:(NSString *)storyboardName images:(NSArray enterBtnFrame = frame; storyboard = storyboardName; enterBtnImage = buttonImageName; - launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; + LaunchIntroductionView *launch = [[LaunchIntroductionView alloc] initWithFrame:CGRectMake(0, 0, kScreen_width, kScreen_height)]; launch.backgroundColor = [UIColor whiteColor]; return launch; } @@ -194,4 +193,10 @@ -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NS } } +- (void)dealloc +{ + [self removeObserver:self forKeyPath:@"currentColor"]; + [self removeObserver:self forKeyPath:@"nomalColor"]; +} + @end