I am using this code to set the parameters of an uitextview i have on my view.
_textview=[[UITextView alloc]init];
[_textview setUserInteractionEnabled:FALSE];
_textview.text=@"Write your message";
_textview.textColor=[UIColor lightGrayColor];
_textview.layer.cornerRadius=6;
_textview.contentInset = UIEdgeInsetsZero;
_textview.delegate=self;
I have in the .h this code
IBOutlet UITextView *_textview;
@property(nonatomic,retain) IBOutlet UITextView *_textview;
I have connected the outlet to the uitextview by using the interface.
What happens is the following:
- (void)textViewDidChange:(UITextView *)inTextView
the above delegate is called but not the following one:
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementString:(NSString *)string
Why is this happening? Am i doing something wrong?
Any help appreciated…
In addition to removing the
_textview = [[UITextView alloc]init];so as to not overwrite your nib loaded textview.The
<UITextViewDelegate>method is:The correct method signature is:
not: