ios swift 3 - UIAlertController 宽度 [英] ios swift 3 - UIAlertController width

查看:23
本文介绍了ios swift 3 - UIAlertController 宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何要创建一个适合屏幕宽度的自定义 alertController 吗?

Is there anyway to create a custom alertController that fit the width of the screen ?

在问这个问题之前我尝试了几件事其中之一是:

I tried several things before asking this question one of them is :

let width:NSLayoutConstraint = NSLayoutConstraint(item: alertController.view, attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, toItem: nil, attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1, constant: view.bounds.width )

alertController.view.addConstraint(width)

但是这行代码总是在我的 alertController 和 Screen 之间形成一个水平空间.

But this line of code always makes a horizontal space between my alertController and the Screen.

推荐答案

这是我目前在 Apple 文档中找到的内容:

Here is what I currently find in the Apple documents:

警报视图的外观:您无法自定义警报视图的外观.

Appearance of Alert Views: You cannot customize the appearance of alert views.

这让我很失望,因为我认为警报视图中的消息文本对于许多用户来说太小了.DrPatience 在上面的评论中提出了一种可能的解决方法.警报视图

This disappoints me as I think the message text in alert views is too small for many users. DrPatience, in a comment above, suggests a possible workaround. Alert Views

这篇关于ios swift 3 - UIAlertController 宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆