xcode5 add new referencing outlet

前端 未结 4 659
不知归路
不知归路 2020-12-18 06:03

Hi I have Just Update my xcode to xcode5, but I have no idea how to add new referencing outlet using xcode 5 by ctrl-drag and drop the label or buttons just like previous wh

相关标签:
4条回答
  • 2020-12-18 06:43

    Start by selecting the ViewController you want the outlet in your storyboard.

    Then click on the suite symbol on the upper right and make sure the storyboard is on the left and the header of the custom UIViewController is on the right, you can click on automatic on top of the right file to get some help with this.

    Then ctrl drag the label from the storyboard on the left between @interface and @end in the header on the right.

    0 讨论(0)
  • 2020-12-18 06:51

    Today, I also encountered this problem. And I resolved it like this:

    0 讨论(0)
  • 2020-12-18 06:56

    I was missing the obvious myself here. To add a new Referencing Outlet (I'm using XCode 9.0) I did the following:

    1. Ensure the storyboard and header file are both open and visible
    2. Right-click on the control and drag the + symbol by New Referencing Outlet to the line in your header file where you want the new variable reference.
    0 讨论(0)
  • 2020-12-18 06:58

    Open your storyboard and click on the editor button (seems like a suit) and select the .h associate to your view :

    enter image description here

    Then, ctrl drag the UI element from the storyboard or xib on your header file or your .m between @interface and @end.

    XCode will show you a pop-up with some options :

    enter image description here

    And you will obtain the following code :

    @interface ViewController : UIViewController
    @property (weak, nonatomic) IBOutlet UIScrollView *myScrollView;
    
    @end
    
    0 讨论(0)
提交回复
热议问题