ios - 如何在不同大小的 Storyboard 中使用相同的 ViewController?

标签 ios

我想使用 Storyboard中的 View Controller 两次(干!)。然而,在一种情况下,我希望它是全屏的,而在另一种情况下,我希望它大约是屏幕的 3/4(在另一个 VC 内)。我怎样才能像那样重用它?

最佳答案

有一个很棒的图书馆。我没有创建它,但我使用过它:https://github.com/m1entus/MZFormSheetController

这里是部分片段

MZFormSheetSegue *formSheetSegue = (MZFormSheetSegue *)segue;
        MZFormSheetController *formSheet = formSheetSegue.formSheetController;
        formSheet.transitionStyle = MZFormSheetTransitionStyleBounce;
        formSheet.shouldCenterVertically = YES;
        formSheet.cornerRadius = 0;
        formSheet.presentedFormSheetSize = CGSizeMake(290, 290);

所以我的想法是,当你进行 segue 时,如果你想要全尺寸,那么正常进行 segue。如果您想要更小的尺寸,请按照我在上面的代码片段中显示的方式使用。阅读自述文件和示例。

如果您在尝试 git 项目时需要进一步的帮助,我将留给您提出更多问题,而不是继续下去。

关于ios - 如何在不同大小的 Storyboard 中使用相同的 ViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25901237/

相关文章:

ios - CATransition 在过渡期间淡化黑色

iphone - 在ios5中使用MPMoviePlayer Controller 播放视频

ios - iPhone X - Safe Area 没有实现全面屏体验?

ios - 如何使用 Realm 移动平台与多个用户共享 Realm 或 Realm 对象?

ios - 如何在 Swift 中通过 Segue 将数据传递给下一个 View ?

ios - ScrollView 隐藏且高度约束设置为 0 时未删除空格

ios - Flutter iOS版本因Pod文件: Podfile is out of date错误而失败

javascript - 点击/单击选择输入/文本框字段的内容

ios - 使用 Alamofire 将对象作为参数发送

ios - ECSlidingViewController 在选择菜单项时移除弹跳动画