我希望当用户在文本文件中输入错误的值时,它会显示警报,并使文本字段为空,并且按钮标题为空。在我的代码中,文本字段为空,但按钮没有获得空值
下面是我的代码
if (monthText>totalnumber) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Value Must Be Less than total number of dogs " delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
NSString *titleMonth =@"0";
[cereniaButton setTitle:@"" forState:UIControlStateNormal];
cereniaTextField.text=@"";
}
int year=12;
int monthButtonTitle=monthText*year;
NSString *titleMonth =[NSString stringWithFormat:@"%d",monthButtonTitle];
[cereniaButton setTitle:titleMonth forState:UIControlStateNormal];