All Projects → manGoweb → DialogView

manGoweb / DialogView

Licence: MIT license
Highly customisable dialog (alert) view made in swift. You can customise pretty much anything from inner paddings and margins to all colors and views.

Programming Languages

swift
15916 projects
shell
77523 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

DialogView

Highly customisable dialog (alert) view made in swift. You can customise pretty much anything prom inner paddings and margins to all colors and views.

Screenshot 1 Screenshot 2

Basic usage

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)

Advanced usage

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)

You can add an image on top of DialogView

let alert: DialogView = DialogView()

//Title will be under the image
alert.setTopImage(UIImage(named: "nice_image")!)
//set size of imageView (sizesToFit)
alert.imageSize = CGSizeMake(100, 50)

You can even have all buttons in one row

//just use this constructor:
let alert: DialogView = DialogView(buttonAlignment: .OneRow)

####It might look like this: Screenshot 3

Installation

DialogView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DialogView"

Author

Ondrej Rafaj, manGoweb.cz [email protected]

License

DialogView is available under the MIT license. See the LICENSE file for more info.

TODO

  • Different animations
  • Custom controls in the canvas
  • More predefined styles
  • Any more ideas? :)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].