Latest 0.2.1
Homepage https://github.com/mathebox/MBSegueCollection
License MIT
Platforms ios 6.0, requires ARC

MBSegueCollection is a growing collection of different custom segues for iOS 6 or later. All segues can be used to present or to dismiss view controllers.

Build Status CocoaPods Platform License

Install

  • Requirement: iOS 6

via CocoaPods

  • Add pod ‘MBSegueCollection’ to your Podfile
  • Run pod install
  • Run open App.xcworkspace

manually

  • or copy the source files from the MBSegueCollection directory to your project

Getting started

All segues can be used to present new view controllers or to dismiss one or multiple view controllers.

Present new view controllers

  1. Create a custom segue in your storyboard file

    present new view controller 1

  2. Set the class of the segue

    present new view controller 2

  3. You can customize the segue in prepareForSegue:sender:. For detailed customization options, check out the demo section.

    Example:

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
      if ([segue.identifier isEqualToString:@"Fade"]) {
          MBFadeSegue *fadeSegue = (MBFadeSegue *)segue;
          fadeSegue.duration = 1.0;
     }
    }

Dismiss view controllers

  1. Implement a method in the destination view controller with the following schema: - (IBAction)YOUR_COOL_METHOD_NAME:(UIStoryboardSegue *)segue. This enables to create an unwind segue to this view controller.
  2. Create an unwind segue by Ctrl+Drag from a button (or the view controller) to the exit icon.

    dismiss view controller 2a
    dismiss view controller 2b
    dismiss view controller 2c

  3. Set the name of the unwind segue.
  4. Implement segueForUnwindingToViewController:fromViewController:identifier: in the destination view controller and return the segue according to the identifier. If the identifier does not match any of your custom segues, return the result of the superclass. In this method you can customize the segue. For detailed customization options, check out the demo section.

    Example:

    - (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController
                                      fromViewController:(UIViewController *)fromViewController
                                              identifier:(NSString *)identifier
    {
      if ([identifier isEqualToString:@"Fade"]) {
         MBSegue *fade = [[MBFadeSegue alloc] initWithIdentifier:identifier
                                                          source:fromViewController
                                                      destination:toViewController];
         fade.type = MBSEgueTypeDismiss;
         return fade;
      }
    
      return [super segueForUnwindingToViewController:toViewController
                                  fromViewController:fromViewController
                                          identifier:identifier];
    }

Note: It’s very important to set the type of the MBSegue to MBSegueTypeDismiss. Otherwise it will break your application.

Customize

The following properties of all segues are customizable:

  • duration (NSTimeInterval)
  • delay (NSTimeInterval)
  • options (UIViewAnimationOptions)

Demo

simple slide open segue
simple slide open segue
gate open inside
gate close inside
gate open outside
gate close outside
fade segue

Todo

  • more segues
  • more segues
  • more segues

License

The MIT License (MIT)

Copyright (c) 2015 Max Bothe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Latest podspec

{
    "name": "MBSegueCollection",
    "version": "0.2.1",
    "summary": "Collection of custom iOS segues.",
    "description": "                   MBSegueCollection is a growing collection of different custom segues for iOS 6 or later.n                   All segues can be used to present or to dismiss view controllers.n",
    "homepage": "https://github.com/mathebox/MBSegueCollection",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Max Bothe",
    "platforms": {
        "ios": "6.0"
    },
    "source": {
        "git": "https://github.com/mathebox/MBSegueCollection.git",
        "tag": "v0.2.1"
    },
    "source_files": [
        "MBSegueCollection",
        "*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This