i am wondering that if it is possible to set the delegate of input stream to another class. So far all examples i have encountered are with self:
[inputStream setDelegate:self].
I want to set delegate to another class like a ViewController not self. Thanks in advance.
iOS - Setting delegate of input stream to another class
1.8k views Asked by M. Salih Kocak At
2
if your
ViewControlleris responding toNSStreamDelegate, you can initiate an instance of the controller and set the delegate as usual.-
for example
update:
use an id or
UIViewController<NSStreamDelegate>variable in theTCPConnectionclass to hold the parent.For example:
...
Or a singlton solution, where you always call only
and have only one instance of this class. For the most cases the best way ;)