简体   繁体   中英

Cannot Control-Drag into ViewController.swift

I am trying to control-drag objects in the storyboard into the ViewController.swift, but nothing is working. I have tried sliders, buttons, switches, pickers, everything. I need to finish this app quickly, so please help!

You probably didn't set your view controller class in your Utility inspector.

When you are on your Storyboard, select your view controller, open the Utility inspector (right panel) and set the related class (which is ViewController in your case). This way, you'll be able to ctrl + drag

在此处输入图片说明

When you create your new file to inherit UIViewController, it should be a CocoaTouch Class and not a swift class. then you can drag from your Main.storyboard to the new View Controller. 在此处输入图片说明

I had faced the same problem. This is what I noticed if you are trying to drag drop into the storyboard with ctrl button pressed the drag drop does not work. Just click drag and drop from the touchpad. I guess this should help.

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