复制/粘贴时,视图控制器变小(Xcode 7,Swift 2)

时间:2016-03-14 22:08:15

标签: xcode swift uiviewcontroller swift2 xcode7

我想指出我知道这个问题:How to copy or duplicate a ViewController in Interface Builder? 并且我遵循了它的指示。

当我复制/粘贴所述ViewController时,新的“粘贴”版本小于原始版本。 The two ViewControllers: One bigger and the other smaller

两者之间的另一个差异是我似乎无法选择“粘贴”的ViewController导航栏来更改其标题。

当我选择粘贴的导航栏而不是我选择原始导航栏时出现的“标题”,“提示”和“后退按钮”时,实用程序区域会显示什么:Pasted's nav Bar

有没有什么方法可以让它与对应的相同尺寸和/或让我选择它的导航栏以便我可以更改它的标题?

对不起,如果这个问题有点奇怪,请耐心等待......

1 个答案:

答案 0 :(得分:0)

So there are two separate issues:

  1. When you copy/pasted that VC, it no longer inherited from a segue its estimated size, so if you had for whatever reason a different size specified for the view it segued from, that is the size for the old VC, but the new one just gets the default size. If this is indeed the case, you can always change the size of the new VC by under Size Inspector, choosing Freeform and specifying it.
  2. To get the navigation bar back, drag a Navigation Item from the Storyboard Object library onto your new VC and you can re-title it (and delete that button you added).