LoginSignup
72
72

More than 5 years have passed since last update.

iOSのStoryboardのカスタムSegueは全力で使っていくべき!

Last updated at Posted at 2014-02-19

Storyboardでの開発をバリバリやるようになったら、ぜひCustom Segueを使っていきましょう。
比較的簡単にカスタムの遷移を作れるのでかっこいいアプリが量産できます。

使用方法は簡単で、カスタムSegueクラスをsegueに指定するだけ。

スクリーンショット 2014-02-20 0.10.06.png

あとは、UIStoryboardSegueを継承したカスタムクラスを作成する!

#import "SegueTest.h"

@implementation SegueTest
- (void)perform {
        // 遷移元と遷移先のViewControllerがとれる
        UIViewController *sourceViewController = (UIViewController *)self.sourceViewController;
        UIViewController *destinationViewController = (UIViewController *)self.destinationViewController;

       // 自前でこの辺にアニメーション挟んだり、遷移元のviewを操作してかっこ良く遷移したり

   // navigation controller にpushしたければ
      [sourceViewController.navigationController pushViewController:destinationViewController animated:YES]; 

       // modal
       // アニメーション指定したければここで変更したり
       destinationViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;

      [sourceViewController presentViewController:destinationViewController animated:YES completion:nil];
}
@end

試しにカスタムSegueを全力で使ってみました。
http://twitpic.com/dw1929
実用性など特にありません。作ったけどセンスがないので特段かっこよくもなかった。

みなさんも、かっこいいアプリをばしばし作りましょう!

72
72
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
72
72