简体   繁体   中英

Cannot assign a custom class to a view in Xcode 7

In Xcode 7 using Swift, I am trying to make a Snapchat-like camera. However, Xcode will not let me control-click and drag (or right-click and drag) a view from my CameraView.xib file to my CameraView.swift file. The view I am trying to control-click and drag is a subview of another view. I have read other similar questions, and the answers say to move the view outside of the other view, change the custom class, make the connection to the .swift file, then put it back as a subview. However, Xcode will not allow me to assign a custom class to the view. Any suggestions on how to fix this issue?

You have to go to your xib, select the root view in the xib, then choose identity inspector on the right.

在此处输入图片说明

In there you have to set the custom class to CameraView

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM