我是 iphone 开发的新手。如果textfield's
文本是否更改,我想发出警报消息。我如何检查文本字段的文本先前值和当前值?
我的代码是
UITextField *txtCon;
NSString *strname;
txtCon.text = @"hello";
strname = txtCon.text;
if(txtCon.text == strname)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Rate on the Appstore!"
message:@"changed"
delegate:self
cancelButtonTitle:@"Later"
otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Rate on the Appstore!"
message:@"not changed"
delegate:self
cancelButtonTitle:@"Later"
otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
}