gpt4 book ai didi

xcode beta 2 xib View 无法在outlet中引用

转载 作者:行者123 更新时间:2023-11-30 10:23:14 24 4
gpt4 key购买 nike

我有一个 Nib ,里面有一个 UIView。我可以很好地设置 UIViewController,但是右键单击并从 View 拖动到文件所有者不允许我连接 View 引用 socket 。它似乎唯一有效的方法是我使用 Storyboard并以这种方式添加 UIViewController 。

想知道是否还有其他人遇到此错误并找到了解决方法。

最佳答案

这似乎是 Xcode 6 Beta 2 的一个已知问题,此处引用来自 Release Notes :

If an existing outlet in a Swift file is declared to be an instance of a class that is implemented in Swift, it is not currently possible to connect an object in a .xib or .storyboard file to that outlet.

Workaround: Create a new outlet by Control-dragging from the object to an empty location in the Swift class. Alternatively, change the outlet’s type to AnyObject, then Control-drag from the object to the outlet. The outlet's type can then be changed back to the correct class. (16968022)

编辑:这个问题似乎已在 Beta 3 中得到解决。

关于xcode beta 2 xib View 无法在outlet中引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24590235/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com