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