[英]UIAlertView Ok button not visible
以下是我用來創建AlertView的代碼。 但是“確定”按鈕不可見。
UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Reset Password"
message:@"\n\n" // IMPORTANT
delegate:self
cancelButtonTitle:nil
otherButtonTitles:OTHER_BUTTON_OK, nil];
prompt.tag=RESET_PASSWORD;
txtOldPwd = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 50.0, 260.0, 25.0)];
[txtOldPwd setBackgroundColor:[UIColor whiteColor]];
[txtOldPwd setPlaceholder:@"Old Password"];
txtOldPwd.text=@"";
[prompt addSubview:txtOldPwd];
[txtOldPwd release];
txtNewPwd = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 80.0, 260.0, 25.0)];
[txtNewPwd setBackgroundColor:[UIColor whiteColor]];
[txtNewPwd setPlaceholder:@"New Password"];
txtNewPwd.text=@"";
[prompt addSubview:txtNewPwd];
[txtNewPwd release];
txtConfirmPwd = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 110.0, 260.0, 25.0)];
[txtConfirmPwd setBackgroundColor:[UIColor whiteColor]];
[txtConfirmPwd setPlaceholder:@"Confirm Password"];
txtConfirmPwd.text=@"";
[prompt addSubview:txtConfirmPwd];
[txtConfirmPwd release];
[prompt show];
[prompt release];
我正在添加我所得到的屏幕截圖。
更新資料
我剛剛發現按鈕實際上在那里。 警報高度過小。 按鈕的一小部分可見。 我嘗試了這種方法,但是按鈕仍然不可見。 盡管警報的高度增加了。
增加\\ n好的
UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Reset Password"
message:@"\n\n\n\n\n" // IMPORTANT
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"ok", nil];
在這些行上更新代碼:
cancelButtonTitle:OTHER_BUTTON_OK
otherButtonTitles:nil];
hay Nitish您可以嘗試使用以下代碼:
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Reset Password"
message:@"\n\n"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
我希望它會起作用。 讓我知道是否需要任何澄清。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.