How does one bind an iPhone SDK control (say a UISlider) using Interface Builder?
Unlike regular Cocoa applications, the bindings tab does not seem to be present when the iPhone-app XIB is opened using Interface Builder
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Declare the control as an IBOutlet in your viewcontroller .h file. In IB, set the File’s Owner for the view as your viewcontroller class (Select File’s owner, in Inspector window click on the (i) button and set the class as your viewcontroller) Now with the File’s Owner selected, click on the blue button with a white arrow in the Inspector window. Bind the IBOutlet for your UISlider to the UISlider on your view.
To get the value of the slider when it changes, create a method in the viewcontroller with the return type IBAction. In the inspector window, if you connect this to the UISlider, it gives you multiple options to select from. Select the ‘Value changed’ option. Now every time the value of the slider is changed your IBAction method will be called.
Hope that helps.