UINavigationController 自定义转场动画(模仿淘宝App跳转)
pod 'LGFTransition' 或者 LGFTransition
接着在 AppDelegate 中导入头文件 UINavigationController+LGFAnimatedTransition.h#import "UINavigationController+LGFAnimatedTransition.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Configure whether to use a custom transition animation here [UINavigationController lgf_AnimatedTransitionIsUse:YES];// [UINavigationController lgf_AnimatedTransitionIsUse:YES showDuration: 1.0 modalDuration:1.0]; return YES;}
在 didFinishLaunchingWithOptions 方法中调用 UINavigationController 由分类添加的新方法 lgf_AnimatedTransitionIsUse传 NO 或不掉用该方法 使用系统效果, 调用该方法并传 YES 启用本效果showDuration Show动画想要执行的时间,默认 0.5 秒modalDuration Modal动画想要执行的时间,默认 0.5 秒Demo 里还添加了一个可以让普通按钮变成pop返回按钮的 UIButton 父类自定义 NavigationBar 上的 UIButton 直接继承 LGFNavigationBackButton 就可以有pop返回的功能了Show 效果展示
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。