调整 UIAlertView 的大小

发布于 2024-11-29 00:13:13 字数 288 浏览 0 评论 0原文

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

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

谢谢!

Is there any way I could resize an UIAlertView so it doesn't cover the tab bar? I tried changing its frame property as it follows but it didn't work.

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

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

病毒体 2024-12-06 00:13:13

据我所知,你不能在不让任何人生气的情况下对警报视图进行过多的修改,但你可以尝试:
https://github.com/TomSwift/TSAlertView

这是 UIAlertView 的一个很好的小替代品

As far as i am aware, you can't fiddle to much with alert view without getting anybody att apple review group angry but you can try with:
https://github.com/TomSwift/TSAlertView

It is nice little replacement for UIAlertView

我早已燃尽 2024-12-06 00:13:13

这是我从网上找到的一个解决方案

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 就变得越小,反之亦然。

Here's one solution which I picked up from the web:

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

Notes: you can set your own values for the button titles, and for the delegate if you wish. When you look at the scaling factors 1.35 and 1.35 (for width and height), the larger the numbers become, the smaller the UIAlertView becomes and vice versa.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文