I have a simple protocol called as OnSuggestionTextChanged
@protocol OnSuggestionTextChanged <NSObject>
-(void)onTextChanged:(NSString*)newText;
@end
And I have another protocol called as TextEditable which has this protocol as a property
#import <Foundation/Foundation.h>
#import "OnSuggestionTextChanged.h"
@protocol TextEditable <NSObject>
@required
-(void)setTextString:(NSString*)text;
-(NSString*)textString;
-(void)notifySuggestionButtonPressed;
-(NSInteger)cursorPosition;
@property(nonatomic,weak)id<OnSuggestionTextChanged> onSuggestionTextChange;
@end
But in my custom UITextView
which conforms to the protocol TextEditable
.
When I try to access the property OnSuggestionTextChanged
I get a:
unrecognized selector for [CustomTextView onSuggestionTextChanged] (not for onTextChanged)
which is really weird because Xcode doesn't throw a compiler error but a runtime error.
Can you please tell me if what I am trying to do is really possible. If so, why am I getting unrecognized selector?
Just in case you guys don't believe me.