Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经从继承 UIImageView 的网络复制了类。如何将该类放在 .xib 文件中?
转到项目导航器编辑-> 导航器-> 显示项目导航器或(cmd+1)选择文件所有者。
在导航编辑器的第三个选项卡中,您可以找到自定义类在此处键入您的类名,您的类将与此 xib 文件链接。如图做
将 UIImageView 添加到您的 .xib 中,然后选择它,单击身份检查器,然后将类从 UIImageView 更改为您的新类。
因此,当您第一次选择图像视图时,您将看到:
将其更改为您拥有的任何子类,例如在我的示例中,UIImageViewSubclass: