首页 技术 正文
技术 2022年11月10日
0 收藏 374 点赞 2,193 浏览 2032 个字

在storyboard中,segue有几种不同的类型,在iphone和ipad的开发中,segue的类型是不同的。在iphone中,segue 有:push,modal,和custom三种不同的类型,这些类型的区别在与新页面出现的方式。而在ipad中,有 push,modal,popover,replace和custom五种不同的类型。

1 自定义DetailStoryboardSegue类继承于UIStoryboardSegue

// 这个类用于处理跳转动画- (instancetype)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination{    self = [super initWithIdentifier:identifier source:source destination:destination];    if (self)    {    }    return self;}- (void)perform{// 如果使用系统的转场动画则不注释,如果使用自定义转场动画则重写该放法。//    [super perform];    // 自定义转成动画代码部分    UIViewController *source = self.sourceViewController;    UIViewController *destination = self.destinationViewController;    // Create a UIImage with the contents of the destination    UIGraphicsBeginImageContext(destination.view.bounds.size);    [destination.view.layer renderInContext:UIGraphicsGetCurrentContext()];    UIImage *destinationImage = UIGraphicsGetImageFromCurrentImageContext();    UIGraphicsEndImageContext();    // Add this image as a subview to the tab bar controller    UIImageView *destinationImageView = [[UIImageView alloc] initWithImage:destinationImage];    [source.parentViewController.view addSubview:destinationImageView];    // Scale the image down and rotate it 180 degrees (upside down)    CGAffineTransform scaleTransform = CGAffineTransformMakeScale(0.1, 0.1);    CGAffineTransform rotateTransform = CGAffineTransformMakeRotation(M_PI);    destinationImageView.transform = CGAffineTransformConcat(scaleTransform, rotateTransform);    // Move the image outside the visible area    CGPoint oldCenter = destinationImageView.center;    CGPoint newCenter = CGPointMake(oldCenter.x - destinationImageView.bounds.size.width, oldCenter.y);    destinationImageView.center = newCenter;    // Start the animation    [UIView animateWithDuration:0.5f                          delay:                        options:UIViewAnimationOptionCurveEaseOut                     animations:^(void) {                         destinationImageView.transform = CGAffineTransformIdentity;                         destinationImageView.center = oldCenter;                     }                     completion: ^(BOOL done) {                         // Remove the image as we no longer need it                         [destinationImageView removeFromSuperview];                         // Properly present the new screen                         [source.navigationController pushViewController:destination animated:nil];                     }];}

2 在Storyboard中设置

Storyboard 自定义转场动画

上一篇: Omi教程-组件
下一篇: angular1.5 Components
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,121
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,593
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,438
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,209
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,845
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,930