测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最新发布 | 2017年8月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Yusuf Kıldan 维护。
YKPopupDialogView 可以通过 CocoaPods 来安装。要安装它,只需将以下行添加到您的 Podfile 中
pod "YKPopupDialogView"
import YKPopupDialogView
let popupDialogView = YKPopupDialogView()
popupDialogView.setTitle("Title")
popupDialogView.setMessage("Message")
popupDialogView.setImage(UIImage(named: "imageName"))
let defaultButton = popupDialogView.addButton("Default", type: YKPopupDialogButtonType.default)
defaultButton.addTarget(self, action: #selector(popupDialogButtonTapped(_:)), for: UIControlEvents.touchUpInside)
let cancelButton = popupDialogView.addButton("Cancel", type: YKPopupDialogButtonType.cancel)
cancelButton.addTarget(self, action: #selector(popupDialogButtonTapped(_:)), for: UIControlEvents.touchUpInside)
popupDialogView.show()
在调用 `show` 函数之前,您可以像示例中那样从 YKPopupDialogView 的实例中访问以下属性,并以您喜欢的方式自定义。
let popupDialogView: YKPopupDialogView = YKPopupDialogView()
popupDialogView.closeOnTap = false
popupDialogView.popupViewCornerRadius = 30
popupDialogView.buttonAlignment = .horizontal
popupDialogView.animationDuration = 0.2
popupDialogView.overlayViewBackgroundColor = UIColor(red: 117.0 / 255.0, green: 117.0 / 255.0, blue: 117.0 / 255.0, alpha: 0.8)
popupDialogView.imageSize = CGSize(width: 120.24, height: 104.04)
popupDialogView.setImage(UIImage(named: "geofencePermissionIcon")!)
popupDialogView.setTitle("Enable Geofencing", attributes: [NSFontAttributeName: UIFont(name: "Kanit-SemiBold", size: 17.0)!, NSForegroundColorAttributeName: UIColor(red: 33.0 / 255.0, green: 33.0 / 255.0, blue: 33.0 / 255.0, alpha: 1.0)])
popupDialogView.setMessage("Enable geofencing to get instant notifications for assignments nearby.", attributes: [NSFontAttributeName: UIFont(name: "Kanit-Regular", size: 16.0)!, NSForegroundColorAttributeName: UIColor(red: 117.0 / 255.0, green: 117.0 / 255.0, blue: 117.0 / 255.0, alpha: 1.0)])
let cancelButton = popupDialogView.addButton("Cancel", textColor: UIColor(red: 189.0 / 255.0, green: 189.0 / 255.0, blue: 189.0 / 255.0, alpha: 1.0), backgroundColor: UIColor.clear, font: UIFont(name: "Kanit-Medium", size: 17.0)!, cornerRadius: 0)
cancelButton.addTarget(self, action: #selector(cancelButtonTapped(_:)), for: .touchUpInside)
let enableButton = popupDialogView.addButton("Enable", textColor: UIColor(red: 245.0 / 255.0, green: 0.0 / 255.0, blue: 7.0 / 255.0, alpha: 0.8), backgroundColor: UIColor.clear, font: UIFont(name: "Kanit-SemiBold", size: 18.0)!, cornerRadius: 0)
enableButton.addTarget(self, action: #selector(enableButtonTapped(_:)), for: .touchUpInside)
popupDialogView.show(YKPopupDialogAnimationPattern.fadeInOut)
public var closeOnTap: Bool
public var popupViewInnerPadding: CGFloat
public var popupViewWidth: CGFloat
public var popupViewCornerRadius: CGFloat
public var popupViewBackgroundColor: UIColor
public var overlayViewBackgroundColor: UIColor
public var buttonHeight: CGFloat
public var buttonPadding: CGFloat
public var imageSize: CGSize
public var animationDuration: TimeInterval
public var buttonAlignment: YKPopupDialogView.YKPopupDialogButtonAlignment
public private(set) var isShown: Bool!
Yusuf Kıldan,[email protected]
YKPopupDialogView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。