NotificationAlertView 0.0.3

NotificationAlertView 0.0.3

测试已测试
语言语言 SwiftSwift
许可 定制
发布最后发布2016年1月
SPM支持SPM

Andrey Pervushin维护。



  • Alexey Kubas

APNotificationAlertView

Appus Studio

'APNotificationAlertView'允许您通过立方变换显示任何视图作为弹出通知。容易扩展且灵活集成。:point_up:

设置

pod 'NotificationAlertView'

示例使用

带自定义视图的弹出

可以作为弹出的任何视图,例如从Storyboard配置的视图。

let popup = APNotificationAlertView.popupWithView(self.samplePopupView)

popup.show()

更改高度或弹出位置

let popup = APNotificationAlertView.popupWithView(self.samplePopupView)

popup.position = APNotificationAlertViewPosition.Bottom

popup.height = 150

popup.show()

问题弹出

带有文本和是/否选项的弹出。使用customCompletionHandler获取按下选项的索引(是:0,否:1)

let question = "Lorem ipsum dolor sit amet?"

let popup = APNotificationAlertView.popupWithQuestion(question)

popup.customCompletionHandler = {

    (index: Int) -> Void in

    APNotificationAlertView.hideAnimated(true)

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

}

popup.show()

对话框弹出

带有文本和多个选项的弹出。使用customCompletionHandler获取按下选项的索引

let question = "Lorem ipsum dolor sit amet?"

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

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

popup.customCompletionHandler = {

    (index: Int) -> Void in

    APNotificationAlertView.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()

文本弹出

简单的文本弹出。使用hideAfterDelay属性或外部动作隐藏

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

popup.hideAfterDelay = 3

popup.animationDuration = 1

popup.show()

开发人员

  • Alexey Kubas、Andrey Pervushin、Appus Studio

许可

Copyright 2015 Appus Studio.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://apache.ac.cn/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.