2015-09-17 90 views

回答

0

簡單的答案是不,你不能自定義默認alertViewController按鈕,但你可以通過使用自定義alertView來實現它。

HERE是您可以使用的一些可用庫。

+0

感謝使用URBNAlert您的善意回覆,但現在我的問題是着我們不使用任何庫嗎? – Mohak

+0

正如我在我的回答中所說**不,你不能**。:) –

0

要跟進@Dharmesh Kheni的回答,雖然在Swift中沒有針對UIAlertViewController的附加功能,但仍可以在swift代碼中使用庫。

我爲Urban Outfitters的工作,我們有一個開放源碼的定製警報,URBNAlert

下面是一些代碼,在迅速

 let alert = URBNAlertViewController(title: "My Title", message: "Message") 

     alert.alertStyler.backgroundColor = UIColor.lightGrayColor() 
     alert.alertStyler.buttonHeight = 44 
     alert.alertStyler.buttonTitleColor = UIColor.redColor() 
     alert.alertStyler.cancelButtonBackgroundColor = UIColor.greenColor() 
     // many, many more things you can customize. 

     alert.addAction(URBNAlertAction(title: "Button Title", actionType: .Normal, actionCompleted: { (action) -> Void in 
      // do some stuff here when the user selects this button 
     })) 

     alert.show() 
相關問題