繁体   English   中英

UIstoryboard:模态选择的“动画”选项在6.0之前的iOS版本上不可用

[英]UIstoryboard: Animates option for Modal segues is not available on iOS versions prior to 6.0

使用Xcode 5将部署目标设置为iOS 5.0时,我收到上述警告。

我不确定是否只是忽略这些警告,还是找到另一种为iOS5提供此功能的方法。

据我所知,我有一些不完善的解决方案:

选项1:以编程方式为iOS6 +展示MainStoryboard; 在iOS5的不同故事板上替换模态选择

presentViewController:animated:completion:

选项2:将完全从情节提要中删除模式segue,在IBAction方法中调用任何segue

选项3:忽略警告(应用仍会被接受吗?)。

(是的,我知道可以选择“仅目标iOS6 +”)

我很感谢那些找到解决此问题方法的人的建议。

更新:通过以下Mikael的回答解决了这个问题:我将UIStoryboardSegue分为以下子类

#import "StandardModalSegue.h"

@implementation StandardModalSegue
- (void) perform {
    //my conditional version of NSLog()
    myLog(kLogVC, 2, @"%@ to %@",self.sourceViewController ,self.destinationViewController);
    //iOS5 replacement for presentModalViewController:animated:
    [self.sourceViewController presentViewController:self.destinationViewController animated:YES completion:nil];
}
@end

并在情节提要中使用了它

在此处输入图片说明

PS:接受Mikael的回答,这是为了帮助像我这样的新手!

界面生成器中的动画复选框会产生此错误。 如果要摆脱它而不是为模态seani动画,则需要创建一个自定义segue并覆盖-(void) perform

您所要做的就是保留当前的序列,但是将其设置为custom。 然后,创建UIStoryboardSegue的子类。 在实现文件中,您放入:

- (void)perform
{
// Add your own animation code here.

    [[self sourceViewController] presentModalViewController:[self destinationViewController] animated:NO];
}

然后,您可以像其他任何segue一样使用此segue。 如果将它附加到UIButton,它将自动被调用,并且您不需要performSegue。 如果不是,则可以使用与iOS5兼容的performSegue,甚至可以根据操作系统版本选择performSegue。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM