I'm using the following code but it is not being recognised when I start editing the UITextView:
-(void)textViewDidBeginEditing:(UITextView *)textView{
[done setHidden:NO];
NSLog(@"Started editing target!");
}
Why is this?
I have added the delegate to the .h file too.
Try to set the delegate of your UITextView. You need to connect the outlet to the delegate in Interface Builder or if you are creating it programmatically you can:
yourTextView.delegate = self;
to set the delegate to the controller you are inserting your element.
if ([self.textView isFirstResponder]) ...
UPDATE: I include the full source to indicate UITextView definitely responds to isFirstResponder @d2burke
#import "TextViewController.h"
@interface TextViewController ()
@property (nonatomic, retain) IBOutlet UITextView *textView;
@end
@implementation TextViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)click:(UIButton *)check
{
BOOL isActive = [self.textView isFirstResponder];
NSLog(@"%d", isActive);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
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