My UITextView delegate method doesn't respond
Posted
by
user611967
on Stack Overflow
See other posts from Stack Overflow
or by user611967
Published on 2011-02-12T07:20:57Z
Indexed on
2011/02/12
7:25 UTC
Read the original article
Hit count: 130
uitextview
Hi guys. I would like to start we that i'm not a very good english speaker, so excuse me if something is wrong. So I have this code
header file :
import
@interface macViewController : UIViewController {
UINavigationItem *navItem;
UITextView *iTextView;
}
@property (nonatomic, retain) IBOutlet UINavigationItem *navItem; @property (nonatomic, retain) IBOutlet UITextView *iTextView;
- (IBAction) btnClicked;
@end
implementation file :
import "macViewController.h"
@implementation macViewController @synthesize navItem, iTextView;
- (IBAction) btnClicked {
if (self.editing == YES) { self.editing = NO;
[iTextView resignFirstResponder];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Data Saved" message:@"Your data was saved" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; }
else { self.editing = YES; [iTextView becomeFirstResponder]; } NSLog(@"works"); self.navItem.rightBarButtonItem = self.editButtonItem; self.navItem.rightBarButtonItem.action = @selector(btnClicked);
}
- (void) textViewDidChangeUITextView *)textView {
NSLog(@"works"); }
So like you guess it's a view based app wich when i tap Edit button the keyboard pops-up then i press Done button and keyboard disappear and appear a alert view.
SO I WANTED TO MAKE THEN I TOUCH THE TEXTVIEW, EDIT BUTTON TO BECOME DONE BUTTON ... THE PROBLEM IS THAT THE METHOD I DELEGATE TO IT DOESN'T RESPOND ... (USING CONSOLE I SAW THAT NOTHING HAPPENS) ... I TRIED DIFFERENT CODE BUT ALL = 0 ... PLEASE HELP I'M NEW ...
© Stack Overflow or respective owner