xcode5 add new referencing outlet

二次信任 提交于 2019-12-18 04:55:13

问题


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 what I did in xcode 4.5

Thank you in advance


回答1:


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

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 :

And you will obtain the following code :

@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIScrollView *myScrollView;

@end



回答2:


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




回答3:


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.




回答4:


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.


来源:https://stackoverflow.com/questions/19149821/xcode5-add-new-referencing-outlet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!