xcode 在 ios 中将故事板从一个应用程序复制到另一个应用程序的最佳方法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37712452/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:52:25  来源:igfitidea点击:

What is the best way to copy storyboard from one app to another in ios?

iosxcodestoryboard

提问by Amit Pal

I am working on renovating my current IOSproject architecture. To move storyboards, I copied the old Main.Storyboardand LaunchScreen.StoryBoardXML to new Main.storyboardand LaunchScreen.StoryBoardXML (Project name was the same).

我正在翻新我当前的IOS项目架构。为了移动故事板,我将旧的Main.StoryboardLaunchScreen.StoryBoardXML复制到新的Main.storyboardLaunchScreen.StoryBoardXML(项目名称相同)。

I also Fixed the localizationand assetslinking part. Everything is fine, and after successfully building the project, UIis getting distorted in iPhone 6and other versions except to iPhone 5. I reconfirm the constraint with the old project, and there was no change.

我还修复了localizationassets链接部分。一切都很好,在成功构建项目后,除了 to 之外的其他版本都UI被扭曲了。我用旧项目再次确认约束,没有任何变化。iPhone 6iPhone 5

The old app is working fine with different-different iPhone screen sizes. Is there any right way to copy the storyboard? Or Am I missing something here?

旧应用程序在不同的 iPhone 屏幕尺寸下运行良好。有没有正确的方法来复制故事板?或者我在这里遗漏了什么?

Edit-1

编辑-1

I think StoryBoardlayout size is limited to iphone5only.

我认为StoryBoard布局大小仅限于iphone5

采纳答案by Gargoyle

The way you did it is correct. You're simply running into the fact that your layout constraints are either non-existant or wrong. There's nothing magical about a storyboard...it's just a file like any other you'd copy into your new project.

你这样做的方式是正确的。您只是遇到了这样一个事实,即您的布局约束不存在或错误。故事板没有什么神奇之处……它只是一个文件,就像您复制到新项目中的任何其他文件一样。

You should probably select your toplevel view in each view controller and then tell Xcode to remove all the constraints and reset them to the suggested ones, and go from there.

您可能应该在每个视图控制器中选择顶级视图,然后告诉 Xcode 删除所有约束并将它们重置为建议的约束,然后从那里开始。

回答by tryKuldeepTanwar

Solution

解决方案

enter image description here

在此处输入图片说明

Than browse your StoryBoardName.storyboard file.

比浏览您的 StoryBoardName.storyboard 文件。

That'll definitely work including all your constants .

这肯定会起作用,包括您的所有常量。

Note : make sure you check copy item if needed when you add you file to protect the original source file.

注意:确保在添加文件时根据需要检查复制项目以保护原始源文件。