【问题标题】:presentModalViewController without animation in storyboard stylepresentModalViewController 没有故事板风格的动画
【发布时间】:2011-12-09 05:17:47
【问题描述】:

我有一个使用传统 nib 接口文件创建的现有 iPhone 应用程序。现在我要将应用程序转换为 iOS5 故事板样式的界面。我已经更改了几乎所有的接口文件并且工作正常。

但我想出了一个小问题。我的现有应用程序有一个presentModalViewController:animated: 的代码,没有动画。这是通过将NO 设置为动画属性。我对 segues 做同样的事情有问题。我找不到任何属性来禁用 segues 中的动画。

【问题讨论】:

  • 我使用自定义 segue 解决了上述问题。我通过扩展UIStoryboardSegue 类创建了自定义segue,并在没有动画的情况下将代码添加到presentModalViewController。这是上述问题的解决方案。 #import "ModalViewWithoutAnimation.h" @implementation ModalViewWithoutAnimation - (void)perform { [self.sourceViewController presentModalViewController:self.destinationViewController animated:NO]; } @end 谢谢。

标签: iphone ios5 segue xcode-storyboard


【解决方案1】:

我使用自定义 segue 解决了上述问题。我通过扩展 UIStoryboardSegue 类创建了自定义 segue,并在没有动画的情况下将代码添加到 presentModalViewController。这是上述问题的解决方案。

#import "ModalViewWithoutAnimation.h"

@implementation ModalViewWithoutAnimation 
- (void)perform {
  [self.sourceViewController presentModalViewController:self.destinationViewController animated:NO]; 
} 
@end

谢谢

【讨论】:

    猜你喜欢
    • 2020-05-19
    • 1970-01-01
    • 1970-01-01
    • 2012-02-21
    • 2023-04-07
    • 2021-05-05
    • 2016-05-04
    • 1970-01-01
    相关资源
    最近更新 更多