0
我用一堆方法创建了一个UIViewController的类别。其中一种方法显示了一个类似于UIAlertController的自定义UIViewController。UIViewControllerTransitioningDelegate不启动他的方法
我使用Objective-C,这是怎么回事我的代码设置
.h文件中
@interface UIViewController (ActivityViewController) <UIViewControllerTransitioningDelegate>
-(void)showAlert;
@end
.m文件
-(void)showAlert{
CustomAlertViewController *alert = [[CustomAlertViewController alloc] initWithNibName:@"CustomAlertViewController" bundle:nil];
self.transitioningDelegate = self;
alert.transitioningDelegate = self;
alert.modalPresentationStyle = UIModalPresentationCustom;
[self presentViewController:alert animated:YES completion:nil];
}
#pragma mark - Custom Transitioning Delegate
- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented
presentingViewController:(UIViewController *)presenting
sourceViewController:(UIViewController *)source
{
(...)
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
presentingController:(UIViewController *)presenting
sourceController:(UIViewController *)source
{
(...)
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
(...)
}
正如你所看到的,我设置该类别作为UIViewControllerTransitioningDelegate,但我的问题是委托方法不会启动,并且自定义转换不会发生,只是默认的转换。
在一个单独的测试项目中,一切正常。
我在做什么错在这里?