Forum Archive

Getting the current View

ruimac

I created a new View where I'm presenting several items (TextViews, Buttons, etc)
I also created a routine for checking the values of some TextFields, that I attached to the action parameter of those text fields.
The routine is called field_edit and its only parameter is (sender).
However I would like to be able to create some new items in the view, inside that routine.
How can I access the View, since the variable used to create it is in the main routine?
Must I make it global? Or is any way to access the current view?

dgelessus

You can get the sender.superview, which may already be your root view. If not, just continue navigating from there. Personally I always make my important views global to avoid this problem.

ruimac

Thank you for the information.
I guess I will go the global way too.