DialogView 0.1.3

DialogView 0.1.3

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2016年3月
SPM支持 SPM

Ondrej Rafaj 维护。




用 Swift 编写的可高度定制的对话框(警报)视图。您几乎可以定制所有内容,从内边距和边距到所有颜色和视图。

Screenshot 1 Screenshot 2

基本用法

let alert: DialogView = DialogView()
alert.setTitle("Dialog Title")
alert.setMessage("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a augue eget felis dictum ultrices ac a arcu.")

let button: DialogButton = alert.addButton("Ok", type: .Done)
button.addTarget(self, action: "myAlertAction:", forControlEvents: .TouchUpInside)
alert.showInController(self)

高级用法

let alert: DialogView = DialogView()

var attr: [String: AnyObject] = [String: AnyObject]();
attr[NSFontAttributeName] = UIFont.init(name: "HelveticaNeue-Light", size: 16)!
alert.setTitle("Dialog Title", attributes: attr)

attr[NSFontAttributeName] = UIFont.init(name: "HelveticaNeue-UltraLight", size: 14)!
alert.setMessage("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a augue eget felis dictum ultrices ac a arcu.", attributes: attr)

var button: DialogButton = alert.addButton("Accept", type: .Accept)
button.addTarget(self, action: "myAlertAction:", forControlEvents: .TouchUpInside)
button.titleLabel?.font = UIFont.init(name: "HelveticaNeue-Light", size: 14)!

button = alert.addButton("Delete", type: .Destruct)
button.addTarget(self, action: "myAlertAction:", forControlEvents: .TouchUpInside)
button.titleLabel?.font = UIFont.init(name: "HelveticaNeue-Light", size: 14)!

button = alert.addButton("Done", type: .Done)
button.addTarget(self, action: "myAlertAction:", forControlEvents: .TouchUpInside)
button.titleLabel?.font = UIFont.init(name: "HelveticaNeue-Light", size: 14)!

button = alert.addButton("Default", type: .Default)
button.addTarget(self, action: "myAlertAction:", forControlEvents: .TouchUpInside)
button.titleLabel?.font = UIFont.init(name: "HelveticaNeue-Light", size: 14)!

alert.showInController(self)

安装

DialogView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "DialogView"

作者

Ondrej Rafaj, manGoweb.cz [email protected]

许可证

DialogView 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。

待办事项

  • 不同的动画
  • 画布中的自定义控件
  • 更多预定义样式
  • 还有更多想法? :)