我希望當用戶在textfiled中輸入錯誤值時,它會顯示警報,並且會使textfield emty和按鈕標題爲空。在我的代碼文本框中,沒有得到空值UIButton的標題沒有設置爲空或iPhone中的空白
下面是我的代碼
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 [email protected]"0";
[cereniaButton setTitle:@"" forState:UIControlStateNormal];
[email protected]"";
}
int year=12;
int monthButtonTitle=monthText*year;
NSString *titleMonth =[NSString stringWithFormat:@"%d",monthButtonTitle];
[cereniaButton setTitle:titleMonth forState:UIControlStateNormal];
你可以嘗試指派 「」 用的NSString * titleMonth = @」「; – CarlJ
也沒有顯示 – james
你可以發佈NSLog(@「%@」,cereniaButton); – CarlJ