Answer the question
In order to leave comments, you need to log in
IOS. How to bind Button and ViewController?
I'm reading the 2013 iOS 6 SDK book (it contains Xcode 4.3) and I have a problem.
The book says that in order to connect a button from Interface Builder with ViewController.h, you need to open the interface Builder itself, create a button in it, then you need to open AssistantEditor, open the ViewController.h file itself in it, then hold down the Control key and use the mouse to drag the appeared line in the ViewController.h file on the line with @ interface. The textbook says that after dragging the line from the button to this line, a small field will appear, in which it is written what will happen if the button is released. It is also written that after the actions taken, if you release the mouse button, a window will appear on the screen that allows you to configure a new action. However (my version of Xcode is 6.3.2) I don't get either and I don't know how to bind the button to the controller. help me please
Answer the question
In order to leave comments, you need to log in
I made a screenshot for you - though the dragging process itself could not be screened - because the buttons do not work. But I drew you a blue line - what will you get
1. Poke in xib or storyboard (what you have there)
2. poke in Asisstan Editor
3. On the button, hold down the control and click the mouse without releasing the mouse button and drag into the window with the code ( your ViewController)
4. Release in the place where you want the method to stick
5. The window for creating Outlet'a will pop out - make sure that Action is in the list
6. Give a name and press Enter - the handler for clicking the create button!
Trouble may be that you did not specify the class for File's Owner
You poke into your xib -> File's Owner -> Identity Inspector -> Class. You specify the class of your ViewController here, after that you connect your outlets (view, buttons, labels), this is if the xib was created separately from the ViewController.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question