【发布时间】:2014-10-25 13:51:03
【问题描述】:
第一次发帖,长期观察。
我正在为我目前正在开发的应用程序使用故事板,并且需要更多的过渡,而不仅仅是前进,尤其是返回。每当我使用这个 segue 来返回菜单时,单击下一个按钮以转到另一个 ViewController,将使整个应用程序崩溃!
不知道怎么回事,我在实现文件中使用这个
#import "SlideLeftSegue.h"
@implementation SlideLeftSegue
- (void)perform{
UIView *sv = ((UIViewController *)self.sourceViewController).view;
UIView *dv = ((UIViewController *)self.destinationViewController).view;
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
dv.center = CGPointMake(sv.center.x - sv.frame.size.width, dv.center.y);
[window insertSubview:dv belowSubview:sv];
[UIView animateWithDuration:0.4
animations:^{
dv.center = CGPointMake(sv.center.x,
dv.center.y);
sv.center = CGPointMake(sv.center.x + sv.frame.size.width,
dv.center.y);
}
completion:^(BOOL finished){
[[self destinationViewController]
dismissViewControllerAnimated:NO completion:nil];
}];
}
@end
这是我的头文件
#import <UIKit/UIKit.h>
// Move to the previous screen with slide animation.
@interface SlideLeftSegue : UIStoryboardSegue
@end
我还在学习,所以如果你知道发生了什么,我很感激初学者的解释。
【问题讨论】:
标签: ios xcode uistoryboard uistoryboardsegue