Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text from UITextFieldTextDidChangeNotification

I have a UITextField with this NSNotification:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldDidChange:) name:@"UITextFieldTextDidChangeNotification" object:_searchTextField];

- (void)textFieldDidChange :(NSNotification *)notif 
    {
     //
    }

The NSLog is when I type in r

NSConcreteNotification 0x193c20 {name = UITextFieldTextDidChangeNotification; object = <UITextField: 0x15a980; frame = (20 20; 280 31); text = 'r'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x15aad0>>}

How do I get the text r out of the notif object?

like image 782
daihovey Avatar asked Mar 31 '12 09:03

daihovey


1 Answers

The notification's object property stores the text field whose text changed, so notif.object.text would contain the text "r".

like image 103
yuji Avatar answered Sep 22 '22 07:09

yuji