Objective-C : iphone programming 'UITextField while editing method'
I got a UITextField and I want to send a UIAlertView if the user enter nothing in 开发者_如何学运维the UITextField.
First capture the input:
NSString *text = myTextField.text;
Then test for null string and present alertview:
if (title == [NSNull null] || title.length == 0 ) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:button1 otherButtonTitles:button2, nil];
[alertView show];
}
精彩评论