That would be a way to do it. However, it would be better to save your state in the class instead of using the title beacuse it may get localized in the future and because you should try to separate UI from logic. You could do something like this: