DDHDynamicViewControllerTransitions视图控制器过渡

联合创作 · 2023-09-27 00:02

使用UIDynamic行为的自定义视图控制器过渡。

用法:

创建一个实例,DDHNavigationControllerDelegate并使其成为导航控制器的委托。

#import "DDHAppDelegate.h"
#import "DDHFirstViewController.h"
#import "DDHNavigationControllerDelegate.h"

@interface DDHAppDelegate ()
@property (nonatomic, strong) DDHNavigationControllerDelegate *navigationControllerDelegate;
@end

@implementation DDHAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    DDHFirstViewController *firstViewController = [[DDHFirstViewController alloc] initWithNibName:@"DDHFirstViewController" bundle:nil];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:firstViewController];
    
    self.navigationControllerDelegate = [[DDHNavigationControllerDelegate alloc] initWithTransitionType:1];
    navigationController.delegate = self.navigationControllerDelegate;
    
    self.window.rootViewController = navigationController;
    
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

Snap

Gravity

Gravity + Rotation

浏览 2
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报