After seeing how a UISegmentedControl deals with segment changes, I asked myself the question "how many more event triggers are needed!"
I had become comfortable with why delegates/protocols and IBActions are needed; I had reasoned that IBAction would be okay for a user interface event (i.e. a button is pressed), whereas delegates/protocol calls are needed because not all events might be user interface driven (i.e. the change of location).
I was working through an exercise in a book, where part of a "challenge" was to implement a UISegmentedControl. I went to the apple documentation fully expecting to see a set of protocol methods and that a delegate can be set up for them, with one of the methods being triggered on a change of segment. There wasn't.
I tried linking my segment control to the Touch Up Inside event (just because that works with buttons), but that action doesn't trigger anything. So I went with the documentation by implementing the target action thing and it works fine.
Why is the target action functionality required? Why has this not been created so that one of the IBAction events listed works when the segment is changed and do it that way, or just have delegate functionality like a text field does?
Thank you
I had become comfortable with why delegates/protocols and IBActions are needed; I had reasoned that IBAction would be okay for a user interface event (i.e. a button is pressed), whereas delegates/protocol calls are needed because not all events might be user interface driven (i.e. the change of location).
I was working through an exercise in a book, where part of a "challenge" was to implement a UISegmentedControl. I went to the apple documentation fully expecting to see a set of protocol methods and that a delegate can be set up for them, with one of the methods being triggered on a change of segment. There wasn't.
I tried linking my segment control to the Touch Up Inside event (just because that works with buttons), but that action doesn't trigger anything. So I went with the documentation by implementing the target action thing and it works fine.
Why is the target action functionality required? Why has this not been created so that one of the IBAction events listed works when the segment is changed and do it that way, or just have delegate functionality like a text field does?
Thank you
Last edited: