Is it possible to programmatically connect a view object to the view controller code, without using control-drag?
yes this should be possible, its like the same effect as calling an “alertview”, problem is you need to set many things like location, size, etc.
Thanks for your answer. I’m not seeing how “alertview” applies. Can you say more, or give an example?
This StckOverFlow will explain. I find it easier to just Control-drag through.
THANK YOU! It’s going to take me a little while to try out what’s there, but that looks like what I need.
Control-drag is great for a few items. But I have about 100 that I need to do, and my wrist gets tired.
I’ve taken a look, and I’m not sure I understand the StackOverFlow instructions.
The instructions say to “click the New Referencing Outlet to connect it to your Outlet”
When I click, it looks like I still have to drag from the little dot to my code. Is that correct? If so, that’s not a solution for me. I’m trying to avoid dragging.
Once you right click on the object you want to connect, your Referencing Outlet should be in the list. As the author states, sometimes you need a little drag to pop the menu up. I have not had that experience on my Mac Pro, maybe the speed of he machine has something to do with the lag.
Thanks for the extra info. I’ve been trying to do it in the inspector, and it’s still not working for me. Based on your suggestion, though, I tried it by right-clicking on the object:
I did get that to work, but it was twitchy and sometimes didn’t work at all. Trying to get the pop-up was more hassle than the click and drag.
Sooooo… from all of this, I think the answer is that I can’t make the connection without the type of movement that stresses my wrist. Any other suggestions still appreciated.
Yep, that can happen with the inspector, that is wjhay i usually drag.
Try this link, the last method is all code, but you will have to edit it for Swift 5. Should work, I have not tried his third method however. My dyslexic brain likes point and click!
@FoundationSW, this video seems to have the info I’m looking for:
It compares three different ways to build the UI.
Fabulous! Chris’ videos are my go to when trying to learn a new task in the development world.
Best to you with your project!