开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜