XXXXXX.h
@protocol XXXXXXDelegate <NSObject>
- (void)sendSth:(NSString *)sth;
@end
@interface XXXXXViewController : BaseViewController
@property (nonatomic , assign) id<XXXXXXDelegate> delegate;
@end
/*——————————————————————————————*/
XXXXXX.m
if (self.delegate && [self.delegate respondsToSelector:@selector(sendSth:)]) {
[self.delegate sendSth:something];
}
作用类
XXXXXX *xxx =[ [XXXXXX alloc] init];
xxx.delegate = self;
- (void)sendSth:(NSString *)sth
{
self.something = sth;
}