Reputation: 276
I have an app where I'm attempting to add a sort of guided tour, where I lead the user from one feature to the next. What I want to do is to let the user interact with various interface elements and when they select the correct one the tour moves to the next step. I'm really having difficulty figuring out a way to do this. There are two ways I've been trying to approach it, but I can't quite figure out how to achieve either, nor can I be certain which would be better. The two options I've been working on are:
Creating a subclass of UIView
that would somehow transfer all user interactions through to the view that is directly behind it, but logs them so when the correct action is taken it can trigger the next step.
Finding a way to add an observer to the UIResponder
(typically a UIButton
, but occasionally a UITableViewCell
or other type) that will let the program know when touches have ended, which will allow the program to then check if the user performed the correct task.
Option 1 is simple enough if it's just a button, but seems more complicated when it's a UITableView
or UIPickerView
.
Option 2 is the one I'm leaning towards if only I could find a way to add an observer to a method (most likely touchesEnded:with:
) in the same way they can be added to properties. That way, I could see when an interaction is made and check if it was the correct one. Of course, I could actually hard code moving to the next step into each method that is supposed to trigger it (if it meets the condition for being part of a guided tour), but that just seems like bad practice.
Does anyone have any suggestions? Is there a 'proper' way to do one of these things, or third option I should consider?
Upvotes: 1
Views: 195