iOS弹窗转场动画控制器

一款自定义的弹窗转场动画,支持UIViewController及其子类。一般使用在需要交互的弹窗功能中,比如选择某个类型,分享菜单等。

效果展示

效果图

使用方式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

- (void)normalPresent:(UIButton *)sender {

NextViewController *controller = [NextViewController new];

[self customDirectionalPresentViewController:controller animated:YES];

}

- (void)RoundPresent:(UIButton *)sender {

NextViewController *controller = [NextViewController new];

[self customDirectionalPresentViewController:controller cornerRadius:20.f animated:YES];

}

- (void)fadePresent:(UIButton *)sender {

NextViewController *controller = [NextViewController new];
[self customFadedPresentViewController:controller animated:YES];

}

Note

如果弹窗的控制器不是全屏的话,需要在presentedViewController中重写

1
2
3
- (CGSize)preferredContentSize {
return CGSizeMake(200.f, 100.f);
}

或者

1
self.preferredContentSize = CGSizeMake(200.f, 100.f);

集成方式

1
pod 'FKCustomPresentationController'

后续功能

  • 手势驱动
  • 不同的方向(目前仅支持从下往上)

Github地址

FKCostomPresentationController

License

FKCustomPresentationController is available under the MIT license. See the LICENSE file for more info.