iOS視圖彈窗:NotificationAlertView

jopen 9年前發布 | 10K 次閱讀 iOS開發 移動開發 NotificationAlertView

'NotificationAlertView' 允許你將視圖作為彈窗提醒,容易擴展和靈活集成。'NotificationAlertView' allow you to show any view as popup notification with cube transform. Developed for easy extension and flexible integration.

Setup

pod 'NotificationAlertView'

Demo usage

Popup with custom view

As a popup may be used any view for example view configured from storyboard

let popup = NotificationAlertView.popupWithView(self.samplePopupView)

popup.show()

change height or popup position

let popup = NotificationAlertView.popupWithView(self.samplePopupView)

popup.position = NotificationAlertViewPosition.Bottom

popup.height = 150

popup.show()

Question popup

Popup with text and Yes/No options. Use customCompletionHandler to get presed option index (Yes:0 No:1)

let question = "Lorem ipsum dolor sit amet?"

let popup = NotificationAlertView.popupWithQuestion(question)

popup.customCompletionHandler = {

    (index: Int) -> Void in

    NotificationAlertView.hideAnimated(true)

    print("Taped button at index: \(index)")

}

popup.show()

Dialog popup

Popup with text and warious number of options. Use customCompletionHandler to get presed option index

let question = "Lorem ipsum dolor sit amet?"

let buttonTitles = ["Yes", "No", "Oh No!"]

let popup = NotificationAlertView.popupDialogWithText(question, options: buttonTitles)

popup.customCompletionHandler = {

    (index: Int) -> Void in

    NotificationAlertView.hideAnimated(true)

    let alert = UIAlertController(title: "Taped button", message: "at index: \(index)", preferredStyle: .Alert)

    alert.addAction(UIAlertAction(title: "Ok",
    style: UIAlertActionStyle.Default,
    handler: { (action) -> Void in

        alert.dismissViewControllerAnimated(true, completion: nil)

    }))

    self.presentViewController(alert, animated: true, completion: nil)   

}

popup.animationDuration = 1

popup.show()

Text popup

Simple popup with text. Use hideAfterDelay property or outer action to hide

let popup = NotificationAlertView.popupWithText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.")

popup.hideAfterDelay = 3

popup.animationDuration = 1

popup.show()

https://github.com/alexey-kubas-appus/Notification-AlertView



項目主頁:http://www.baiduhome.net/lib/view/home/1447486517913

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!