【问题标题】:Resize UIAlertView调整 UIAlertView 的大小
【发布时间】:2011-08-08 14:49:37
【问题描述】:

有什么方法可以调整 UIAlertView 的大小,使其不覆盖标签栏?我尝试按如下方式更改其框架属性,但没有成功。

CGRect alertViewFrame = self.alertView.frame;
alertViewFrame.size.height = alertViewFrame.size.height - kTabBarHeight;
self.localizationDisabledView.frame = localizationDisabledViewFrame;

谢谢!

【问题讨论】:

  • 嗯,最好的选择是继承 uialertview,(我也这样做了,将 alertview 的背景颜色从蓝色更改为 gteen)。
  • According to Apple 子类化 UIAlertView 实际上不是一个选项。 “UIAlertView 类旨在按原样使用,不支持子类化。此类的视图层次结构是私有的,不得修改。”

标签: iphone cocoa-touch uialertview


【解决方案1】:

据我所知,如果不让苹果评论小组的任何人生气,您就无法对警报视图进行太多操作,但您可以尝试: https://github.com/TomSwift/TSAlertView

它是 UIAlertView 的不错的小替代品

【讨论】:

    【解决方案2】:

    Here's one solution我从网上捡到的:

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"My title"
                                                    message:@"My message"
                                                   delegate:nil
                                          cancelButtonTitle:nil
                                          otherButtonTitles:nil];
    
    
    alert.transform = CGAffineTransformIdentity;
    alert.transform = CGAffineTransformScale( alert.transform, 1.35, 1.35);
    [alert show];
    

    注意:您可以为按钮标题设置自己的值,如果您愿意,也可以为委托设置值。当您查看比例因子 1.35 和 1.35(宽度和高度)时,数字越大,UIAlertView 越小,反之亦然。

    【讨论】:

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