I am curious if and how to make a Controller be the delegate for two different objects.
Is this allowed or is this like multiple inheritance in Java?
Suppose I wanted to have one controller that responded to: <UIAccelerometerDelegate>
and <CLLocationManagerDelegate>
Would the header file look like this?
@interface MainViewController : UIViewController <UIAccelerometerDelegate> AND <CLLocationManagerDelegate> {
Actually, it works quite well. Declare your interface like this:
@interface MainViewController : UIViewController <UIAccelerometerDelegate, CLLocationManagerDelegate>
and then implement the methods from both delegate interfaces.
Nope, like this:
@interface MainViewController : UIViewController <UIAccelerometerDelegate, CLLocationManagerDelegate> {
@interface MainViewController : UIViewController <UIAccelerometerDelegate, CLLocationManagerDelegate>
As simple as that:
@interface MainViewController : UIViewController <UIAccelerometerDelegate, CLLocationManagerDelegate>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With