How to call a method from another class that's been instantiated within the current class
Posted
by
Pavan
on Stack Overflow
See other posts from Stack Overflow
or by Pavan
Published on 2012-07-04T15:12:29Z
Indexed on
2012/07/04
15:15 UTC
Read the original article
Hit count: 209
my screen has a few views like such
__________________
| _____ |
| | | | //viewX is a video screen
| | | |
| viewX | vY | | //viewY is a custom uiview i created.
| |____| | //it contains a method which i would like to call that toggles
|_________________| //the hidden property of this view. and when it hides, a little
| | //button is replaced no the top right corner on top of viewX
| viewZ | //the video layer
| |
|_________________| //viewZ is a view containing many square views - thumbnails.
my question is, i dont know how to register for touch events so that it recognises any touch event on no matter which view the user touches the screen.. atm im handling the touch events for each view inside it. so all works well...
however what im trying to do is that when the user taps anywhere else on the screen but on viewY, viewY should dissapear by calling that method in the viewY class.
this viewY class is instantiated and has no xib file attached to it. the uiview is created progammatically in the viewY class. this whole class for viewY behviour is instantiated in viewX - the video view.
my boss says add delegates.. although i have now clue how to do that... any help?
is there anyway i can just make it really simple and be able to say REMOVE VIEW no matter which class im calling from?
Also ive seen other people achieve this by using these funky arrows -> ... <- etc.. although im not sure if thats what i need or how to implement such a thing.
ah i think ive made my question quite complicated but i really mean it to be a simple one, and know it can be done in an easy way!
© Stack Overflow or respective owner