【问题标题】:UIAlertView customization, how to manage standart buttons?UIAlertView 自定义,如何管理标准按钮?
【发布时间】:2011-06-13 10:53:03
【问题描述】:

我自定义UIAlertView 并添加UITextViewUITextfield,但我需要在UIAlertView 视图的底部设置按钮(我在标准init 添加按钮)。虽然init 我的UIAlertView 我添加了消息:@"\n\n\n\n\n" 这给了我5 个字符串但是当我添加另一个UIAlertView 时显示它是标准的文本视图。 看一下图像,以更清楚地了解我拥有什么以及我需要什么。

【问题讨论】:

  • 我认为你应该检查控制器的自动调整大小:)
  • 嘿,你能告诉我你到底想做什么。鉴于空间限制,我认为 modalViewController 在您的情况下可以更好地工作。请提供更多详细信息以帮助更好地理解问题。您的问题是 textField 位于按钮下方并且您不希望这种情况发生吗?

标签: iphone button uitextfield uitextview uialertview


【解决方案1】:

使用这个例子......

 // Create Alert
    UIAlertView* av = [UIAlertView new];
    av.title = @"Find";
    // Add Buttons
    [av addButtonWithTitle:@"Cancel"];
    [av addButtonWithTitle:@"Find & Bring"];
    [av addButtonWithTitle:@"Find & Go"];
    [av addButtonWithTitle:@"Go to Next"];
    // Make Space for Text View
    av.message = @"\n";
    // Have Alert View create its view heirarchy, set its frame and begin bounce animation
    [av show];
    // Adjust the frame
    CGRect frame = av.frame;
    frame.origin.y -= 100.0f;
    av.frame = frame;
    // Add Text Field
    UITextField* text = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
    text.borderStyle = UITextBorderStyleRoundedRect;
    [av addSubview:text];
    [text becomeFirstResponder];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多