I got a view controller class (MyViewController) that deals with a UIView subclass (MyView). I don't want to let any class except the view controller class know about the UIView subclass, so I cannot import MyView.h
in MyViewController.h
.
So, in MyViewController.m
, I put
#import "MyViewController.h"
#import "MyView.h"
@interface MyViewController (PrivateObjects)
MyView *myView;
@end
...
However, to get feedback from MyView, I use a delegate. That delegate has to implement the MyViewDelegate
protocol.
How can I implement the MyViewDelegate
protocol inside MyViewController
without having to #import
MyView.h
in MyViewController.h
?
@interface MyViewController (PrivateObjects) <MyViewDelegate>
....
(BTW, you can't declare a new ivar in a category.)
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