简体   繁体   中英

Having trouble linking my timer buttons (Xcode)

UPDATE: Thank you to everyone that offered a solution. And it appears XCode was just being a bit buggy because I came back to my project and it's working fine now. Again thank you!

first thank you to anyone who offers some help.

I am attempting to link my buttons and nothing happens when I try to drag them to their connection.

As you can see the selection does not highlight to allow for the connection. I was able to connect the Date Picker but have had no luck with the start, stop, or pause button. I am learning from the Instructable tutorial.

截图

Any help would be awesome

If you cannot link to an item in your storyboard from an outlet and the item on the storyboard does not highlight, the usual issue is that you have not set the correct class/object type. For instance, if you have specified a sub-class of UIButton type in your IBOutlet declaration but have a plain UIButton on the storyboard, or a totally different class than UIButton in your your IBOutlet declaration, you might not be able to link the items.

I noticed that sometimes even if you have the correct class, this BUG can occur. (IF you have everything else set straight as from the comments and other answers here)

Instead of cleaning projects and restarting Xcode as others suggest (which maybe is needed sometimes)

Another solution:

1: Create a property IBOutlet manually typed where you want to connect it.

2: Once created, drag the property IBOutlet from the code to the element in the storyBoard instead of the other way around.

You will notice things will connect without problems and everything will start working again.

在此输入图像描述

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