iOS - Setting delegate of input stream to another class
问题 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. 回答1: if your ViewController is responding to NSStreamDelegate , you can initiate an instance of the controller and set the delegate as usual. @interface ViewController : NSOperation<NSStreamDelegate> ... - ViewController *vc =