UIAlertController text alignment

前端 未结 8 1806
醉话见心
醉话见心 2020-12-05 04:07

Is there a way to change the alignment of the message displayed inside a UIAlertController on iOS 8?

I believe accessing the subviews and changing it for the UILabel

8条回答
  •  爱一瞬间的悲伤
    2020-12-05 04:59

    This property exposes the text fields, so could probably be used to configure them:

    textFields

    The array of text fields displayed by the alert. (read-only)

    Declaration

    SWIFT

    var textFields: [AnyObject]? { get }
    

    OBJECTIVE-C

    @property(nonatomic, readonly) NSArray *textFields
    

    Discussion

    Use this property to access the text fields displayed by the alert. The text fields are in the order in which you added them to the alert controller. This order also corresponds to the order in which they are displayed in the alert.

    Note: even though it says the property is readonly, it returns an array of text field object references which can be used to modify the controls.

提交回复
热议问题