iOS7中的UIAlertViewStyleLoginAndPasswordInput

时间:2013-09-12 08:15:55

标签: ios login uialertview landscape ios7

我在iOS7上测试我的工作应用程序。当应用程序启动时,它会要求玩家登录。要收集用户凭据我正在使用带有 UIAlertViewStyleLoginAndPasswordInput

样式的AlertView

在iOS6中看起来很好

enter image description here

但iOS7上发生了一些奇怪的事情

enter image description here

包含标题的AlertView UILabel仍然存在,但它被隐藏,因为似乎有一个过高的高度。滚动UILabel最终会显示标题。

2 个答案:

答案 0 :(得分:0)

在我将应用程序移植到iOS 7时,我已经尝试过我的工作,因此像素中存在一些变化。该应用程序必须重新配置为相同。我建议手动调整对话框的高度以适应屏幕。

P.S。:我还在学习阶段,所以如果我说的不正确,请避免让我知道。谢谢。

答案 1 :(得分:0)

看起来您正在尝试将标题或消息设置为特殊高度。消除高度变化并允许系统自动创建高度。

你没有发布任何代码,所以,我只是在猜测。

我刚刚为iOS7交换了我的警报视图代码,这比旧风格简单得多。 _prompt here是一个设置为UIAlertView

的属性
- (IBAction) addEntryTapped:(id)sender
{
    [_editorTextView resignFirstResponder];
    [self saveTextChanges];
    [self dismissPopovers];
    _prompt = [[UIAlertView alloc] init];
    // change the UIAlertViewStyle to the one you need to use
    _prompt.alertViewStyle = UIAlertViewStylePlainTextInput;
    UITextField *text = [_prompt textFieldAtIndex:0];
    _textField = text;
    [_prompt setDelegate:self];
    [_prompt setTitle:@"New Entry Title..."];
    [_prompt setMessage:@""];
    [_prompt addButtonWithTitle:@"Cancel"];
    [_prompt addButtonWithTitle:@"OK"];

    [_textField setPlaceholder:@"New Entry Title"];
    _textField.autocapitalizationType = UITextAutocapitalizationTypeWords;
    _textField.autocorrectionType = UITextAutocorrectionTypeNo;

    [_prompt show];

    // set cursor and show keyboard
    [_textField becomeFirstResponder];
}

The alert with the change John requested.