Preface
During development, although UI work may seem to lack technical depth, sometimes you still need to create special transition effects. This tutorial references UIPresentationController Tutorial: Getting Started and provides an Objective-C version translation with some minor modifications.

Background
Transitions are already very familiar in iOS today, but finding a reliable one with a dimming overlay proved difficult—few of the available options were dependable.
Either this issue or that issue would make it unsuitable.

Based on the Raywenderlich tutorial, I translated it into an Objective-C version with some minor modifications.
How to Use
- Import the header file
1
2
#import "SlideInPresentationManager.h"
- Declare the property
1
@property (nonatomic, strong) SlideInPresentationManager *slideInTransitioningDelegate;
- Use the following code when presenting the modal controller
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
- (IBAction)presentAction:(UIButton *)sender {
PresentationDirection direction;
if (sender.tag == 100) {
NSLog(@"左侧弹出模态转场");
direction = PresentationDirectionLeft;
} else if (sender.tag == 101) {
NSLog(@"上弹出模态转场");
direction = PresentationDirectionTop;
} else if (sender.tag == 102) {
NSLog(@"右弹出模态转场");
direction = PresentationDirectionRight;
} else {
NSLog(@"下弹出模态转场");
direction = PresentationDirectionBottom;
}
self.slideInTransitioningDelegate = nil;
// Control the dimming overlay view transition (core code)
self.slideInTransitioningDelegate = [[SlideInPresentationManager alloc] init];
self.slideInTransitioningDelegate.direction = direction;
self.slideInTransitioningDelegate.disableCompactHeight = NO;
self.slideInTransitioningDelegate.sliderRate = 1.0/3.0;
// Create controller instance
PresentController *presentVC = [[PresentController alloc] initWithNibName:@"PresentController" bundle:[NSBundle mainBundle]];
presentVC.transitioningDelegate = self.slideInTransitioningDelegate;
presentVC.modalPresentationStyle = UIModalPresentationCustom;
[self presentViewController:presentVC animated:YES completion:nil];
}
That’s it—enjoy!