0
我创建了一个UIStoryboardSegue
的子类,以便通过可选的动画实现模态轮回。设置UIStoryboardSegue子类的属性
(的UIStoryboardSegue
子类): .H
#import <UIKit/UIKit.h>
@interface ModalSegue_OptionalAnimation : UIStoryboardSegue
@property (readwrite) BOOL withAnimation;
@end
.M
#import "ModalSegue_OptionalAnimation.h"
@implementation ModalSegue_OptionalAnimation
-(void) perform{
BOOL _withAnimation_Va = self.withAnimation;
[[[self sourceViewController] navigationController] pushViewController:[self destinationViewController] animated:_withAnimation_Va];
}
@end
但是我不确定现在如何调用从外面这个属性。
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([[segue identifier] isEqualToString:@"segue_qVC_to_cVC_checkAnswer"]) {
CheckAnswerViewController *cVC = [segue destinationViewController];
if(segue_QVC_ISEXAM) {
//Something like this:
//segue.withAnimation = NO;
//Settings the property to NO is like 'I dont animation when performing the segue'
}
....
在我的故事板中,我已经将刚刚创建的类设置为自定义。
感谢,那工作就好了! 尽管我不得不使用'[[self sourceViewController] presentModalViewController:[self destinationViewController] animated:_withAnimation_Va];'而不是上面的那个。 – paskl