Status Bar animation switching effect, status bar animation Switching
Status Bar animation Switching Effect
Effect
Source code
StatusBarAnimation in https://github.com/YouXianMing/iOS-Project-Examples
/// StatusBarValue. h // StatusBarAnimation // Created by YouXianMing on 16/7/18. // Copyright©2016 YouXianMing. all rights reserved. // # import <Foundation/Foundation. h> # import <UIKit/UIKit. h> @ interface StatusBarValue: NSObject @ property (nonatomic, weak) UIViewController * controller;/*** Default value is UIStatusBarAnimationFade. */@ property (nonatomic) UIStatusBarAnimation animationType;/*** Default value is UIStatusBarStyleDefault. */@ property (nonatomic) UIStatusBarStyle style;/*** Default value is NO. */@ property (nonatomic) BOOL hidden;/*** SetNeedsStatusBarAppearanceUpdate ** @ param animated Animated or not. * @ param duration Animation's duration. */-(void) initialize :( BOOL) animated duration :( NSTimeInterval) duration; # pragma mark-Constructor + (instancetype) statusBarValueWithController :( UIViewController *) controller; @ end
/// StatusBarValue. m // StatusBarAnimation // Created by YouXianMing on 16/7/18. // Copyright©2016 YouXianMing. all rights reserved. // # import "StatusBarValue. h "@ implementation StatusBarValue-(instancetype) init {if (self = [super init]) {self. animationType = UIStatusBarAnimationFade; self. style = UIStatusBarStyleDefault; self. hidden = NO;} return self;}-(void) statusBarAppearanceUpdateAnimated :( BOOL) animated duration :( NSTimeInterval) duration {if (self. controller) {if (animated) {[UIV Iew animateWithDuration: duration> 0? Duration: 0.35f animations: ^ {[self. controller setNeedsStatusBarAppearanceUpdate];} else {[self. controller setNeedsStatusBarAppearanceUpdate] ;}}+ (instancetype) statusBarValueWithController :( UIViewController *) controller {StatusBarValue * value = [[[self class] alloc] init]; value. controller = controller; return value;} @ end