简体   繁体   English

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

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

I'm getting the above warnings using Xcode 5 with a deployment target set to iOS 5.0. 使用Xcode 5将部署目标设置为iOS 5.0时,我收到上述警告。

I'm not sure whether to simply ignore these warnings OR find an alternative way of providing this functionality for iOS5. 我不确定是否只是忽略这些警告,还是找到另一种为iOS5提供此功能的方法。

As far as I can see I have a number of imperfect solutions: 据我所知,我有一些不完善的解决方案:

Option 1: present the MainStoryboard programmatically for iOS6+; 选项1:以编程方式为iOS6 +展示MainStoryboard; replace modal segues on a different storyboard for iOS5 with 在iOS5的不同故事板上替换模态选择

presentViewController:animated:completion:

Option2: would be to drop modal segues entirely from the storyboard(s), calling any segues within IBAction methods 选项2:将完全从情节提要中删除模式segue,在IBAction方法中调用任何segue

Option3: ignore the warnings (would the app still be accepted?). 选项3:忽略警告(应用仍会被接受吗?)。

(Yes, I'm aware of "target iOS6+ only" as an option) (是的,我知道可以选择“仅目标iOS6 +”)

I'd appreciate advice from those who've found ways to solve this problem. 我很感谢那些找到解决此问题方法的人的建议。

Update: solved this thanks to Mikael's answer below: I subclassed UIStoryboardSegue as below 更新:通过以下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

and used it in storyboard thus 并在情节提要中使用了它

在此处输入图片说明

PS: accepting Mikael's answer, this here to help newbies like me! PS:接受Mikael的回答,这是为了帮助像我这样的新手!

It's the animate checkbox in interface builder that creates this error. 界面生成器中的动画复选框会产生此错误。 If you want to get rid of it and not animate your modal segue you need to create a custom segue and override -(void) perform 如果要摆脱它而不是为模态seani动画,则需要创建一个自定义segue并覆盖-(void) perform

All you have to do is keep the segues you have now but set them to custom. 您所要做的就是保留当前的序列,但是将其设置为custom。 Then you create a subclass of UIStoryboardSegue. 然后,创建UIStoryboardSegue的子类。 In the implementation file you put: 在实现文件中,您放入:

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

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

You can then use this segue like any other segue. 然后,您可以像其他任何segue一样使用此segue。 If it's attached to a UIButton it gets called automatically and you do not need performSegue. 如果将它附加到UIButton,它将自动被调用,并且您不需要performSegue。 If not you can use the performSegue that is compatible with iOS5 or even choose a performSegue depending on the version of OS. 如果不是,则可以使用与iOS5兼容的performSegue,甚至可以根据操作系统版本选择performSegue。

暂无
暂无

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

相关问题 类不可用。 在6.0之前的iOS版本上无法使用取消同步功能 - Class Unavailable. Unwind segues are not available on iOS versions prior to 6.0 iOS版本6.0之前的UICollectionView - UICollectionView on iOS versions prior to 6.0 警告:属性不可用:6.0之前的iOS版本上的最小字体比例 - warning: Attribute Unavailable: Minimum Font Scale on iOS versions prior to 6.0 6.0之前的iOS版本不支持-fembed-bitcode - -fembed-bitcode is not supported on versions of iOS prior to 6.0 恢复标识符在6.0警告之前的ios版本上不可用 - Restoration identifier is not available on ios version prior to 6.0 warning 自动首选最大布局宽度在8.0之前的iOS版本上不可用 - Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0 将应用程序升级到iOS 7 - 错误“iOS版本6.0之前的自动布局”(但希望iOS 7不旧) - Upgraded app to iOS 7 - error “Auto Layout on iOS Versions prior to 6.0” (but want iOS 7 not older) iOS情节提要模态关卡和内存 - iOS Storyboard Modal Segues and Memory 在iOS 9.3.2上运行具有部署目标5.1.1的应用程序时出错(6.0之前的iOS版本不支持-fembed-bitcode)。 - Error when running an app with deployment target 5.1.1 on iOS 9.3.2 (-fembed-bitcode is not supported on versions of iOS prior to 6.0.) 禁止在8.0之前的iOS版本上使用“自动首选最大布局宽度”警告 - Inhibit `Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0` warnings
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM