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,但我的問題是委託方法不會啓動,並且自定義轉換不會發生,只是默認的轉換。
在一個單獨的測試項目中,一切正常。
我在做什麼錯在這裏?