TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jan 2015 |
Maintained by Max Bothe.
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.
All segues can be used to present new view controllers or to dismiss one or multiple view controllers.
Create a custom segue in your storyboard file
Set the class of the segue
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;
}
}
- (IBAction)YOUR_COOL_METHOD_NAME:(UIStoryboardSegue *)segue
. This enables to create an unwind segue to this view controller.Create an unwind segue by Ctrl+Drag
from a button (or the view controller) to the exit
icon.
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.
The following properties of all segues are customizable:
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.