StoryBoard 使用自定义 跳转 方式

87 篇文章 0 订阅

@interface CustomViewController ()

@property (weak, nonatomic) IBOutlet UITextField *textField;


@end


@implementation CustomViewController


- (void)viewDidLoad {

    [super viewDidLoad];

   

    self.view.backgroundColor = [UIColor cyanColor];

}


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

{

    //可视化编程页面跳转方式(storyBoard

    [self performSegueWithIdentifier:@"custom" sender:nil];

}



//这个是只要有segue那根线,也就是页面之间的跳转就会执行这个方法。

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

{

    //获取目的控制器

    ViewController *vc = (ViewController *)segue.destinationViewController;

    //获取源控制器

//    CustomViewController *cvc = (ViewController *)segue.sourceViewController;

    

    if ([segue.identifier isEqualToString:@"push"]) {

       

        //传值

        vc.text = self.textField.text;

        

    }else

    {

        NSLog(@"其他情况");

    }

    

    

}

============================


#import "CustomSegue.h"


@implementation CustomSegue


//自定义segue会自动触发此方法.

-(void)perform{

    

    //第一步:获取源控制器

    UIViewController *v1 = (UIViewController *)self.sourceViewController;

    


    //第二步:获取目标控制器

    UIViewController *v2 = (UIViewController *)self.destinationViewController;

    

    

    //第三步:自定义页面切换效果

    [UIView transitionFromView:v1.view toView:v2.view duration:2 options:UIViewAnimationOptionTransitionCurlUp completion:^(BOOL finished){

        

    }];

    

}



@end






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值