dicle
dicle

Reputation: 1162

How to return object of the protocol in the method

I would like to return an object of the protocol in the method. Any quicker way to achieve this? Thanks.

#import "OverlayView.h"

@protocol ErrorOverlayDelegate <NSObject>
- (void)errorOverlayOKButtonAction:(UIButton*)sender;
@end

@interface ErrorOverlay : UIView
@property (nonatomic, weak) id<ErrorOverlayDelegate> delegate;
@end

Upvotes: 0

Views: 329

Answers (1)

leoformaggio
leoformaggio

Reputation: 450

Just add one more parameter to your method, preferably the first argument, like the example below:

- (void)errorOverlay:(ErrorOverlay *)overlay OKButtonAction:(UIButton *)sender;

Then pass self as the argument.

Upvotes: 2

Related Questions