开发者

Objective-C : iphone programming 'UITextField while editing method'

开发者 https://www.devze.com 2023-01-04 15:14 出处:网络
I got a UITextField and I want to send a UIAlertView if the user enter nothing in 开发者_如何学运维the UITextField.First capture the input:

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号