For the Silver challenge, I’ve added a UISegmentedControl to the HypnosisView view programmatically and that part is OK. Now I want to connect pressing a segment button to a method. I don’t know how to do that.
I haven’t found any example in the text so far and browsing the documentation has not helped. A document:
User Experience -> Controls -> Segmented Control Programming Guide -> Using Segmented Controls
has the following code fragment to illustrate connecting an action to a target
[[segControl cell] setTag:0 forSegment:0];
[[segControl cell] setTag:1 forSegment:1];
[[segControl cell] setTag:2 forSegment:2];
int clickedSegment = [sender selectedSegment];
int clickedSegmentTag = [[sender cell] tagForSegment:clickedSegment];
So I tried the setTarget and setAction methods with my UISegmentedControl object, but Xcode tells me that no visible @interface declares either method. Puzzled I am.
Could someone suggest either a place in the text that would help me, something in Apple’s documentation that would help me?