1 Reply
      Latest reply on Dec 3, 2019 10:30 PM by Claude31
      petra1 Level 1 Level 1 (0 points)

        Hello,

        Because of my disability it is dificult for me to press the controll key and to drag and drop something at the same time, like you have to do in order to make the conection between the elements in the storyboard and the Viewcontroller.swift  file.

         

        So I am wondering whether it is posible to make the conections by typing the corresponding code into the editor instead of playing around with the mouse? Provided you have enough experience to do so. Whitch I don't have yet.:-(

         

        Best Regards

         

        Petra Ritter

         

         

        • Re: Conecting the elements on the Storybord to code
          Claude31 Level 8 Level 8 (7,245 points)

          What you can do is use the connections Inspector:

           

          - select the object in Interface Builder

          - open the Inspector panel on thr right (with the sqaure at the extreme top right)

          - select the last icon on the right, for connections Inspector (circled arrow)

          - now you can click on a small circle (like New reference outlet) and drag to the code, with no need to control-drag.

          - you can connect to IBAction in the same way

           

          Note: if you right-click on the object in IB, you will see the panel with all the connections. You can use it instead of the Connections Inspector.

           

          Second way is to connect from code.

          To illustrate:

          - create the object in Interface Builder (a Label)

          - declare the var in code

          @IBOutlet weak var lengthLabel: UILabel!

               => a small circle appears at its left.

          - click and drag (no control drag) from this circle to the object in Interface Builder

          - That creates the connection

          - You see the small circle turn black.