简体   繁体   English

UIAlertView确定按钮不可见

[英]UIAlertView Ok button not visible

Following is the code I am using to create an AlertView. 以下是我用来创建AlertView的代码。 But the Ok button is not visible. 但是“确定”按钮不可见。

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

I am adding a screenshot of what I am getting. 我正在添加我所得到的屏幕截图。

在此处输入图片说明

Update 更新资料

I just discovered that button is actually there. 我刚刚发现按钮实际上在那里。 Height of Alert is too less. 警报高度过小。 A very little portion of button is visible. 按钮的一小部分可见。 I tried this approach but the button is still not visible. 我尝试了这种方法,但是按钮仍然不可见。 Although the height of alert increases. 尽管警报的高度增加了。

increase the \\n ok 增加\\ n好的

UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Reset Password" 
                                                     message:@"\n\n\n\n\n" // IMPORTANT
                                                    delegate:self 
                                           cancelButtonTitle:nil 
                                           otherButtonTitles:@"ok", nil];

在此处输入图片说明

update your code on these lines: 在这些行上更新代码:

cancelButtonTitle:OTHER_BUTTON_OK 
otherButtonTitles:nil];

hay Nitish you can try with this code: hay Nitish您可以尝试使用以下代码:

UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"Reset Password"
                          message:@"\n\n" 
                          delegate:nil
                          cancelButtonTitle:@"OK"
                          otherButtonTitles:nil];

I hope It will work. 我希望它会起作用。 Let me know if any clarification needed. 让我知道是否需要任何澄清。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM