Closed barnaclejive closed 8 years ago
Thanks for the pull request. However I do not think this is necessary.
You can access to the properties declared inside PMAlertController. In this way, you can customize everything of the components inside it: title, description, image, buttons.
Like this:
let alertVC = PMAlertController(title: "Locate your device", description: "Enables access to your location: discover what you can do when you're traveling and what is available near you.", image: UIImage(named: "flag.png"), style: .Alert)
//Add action
alertVC.addAction(PMAlertAction(title: "Cancel", style: .Cancel, action: { () -> Void in
print("Cancel")
}))
//Add action and customize it
let actionAllow = PMAlertAction(title: "Allow", style: .Default, action: { () in
print("Allow")
})
actionAllow.setTitleColor(UIColor.blueColor(), forState: .Normal)
alertVC.addAction(actionAllow)
//Customize alert title
alertVC.alertTitle.font = (UIFont(name: "ArialMT", size: 40))
self.presentViewController(alertVC, animated: true, completion: nil)
Result:
Let me know. If all is clear, please close this pull request. Thanks :)
That makes sense, however, when using PMAlertController via CocoaPods those labels are not accessible. If exposing them is the intended way to customize them, they will need to be marked public.
Thank you very much for the suggestion @barnaclejive, i've updated the project and now there is a new version 1.0.1
Actions extend UIButton and do not anything additional to customize. However, the alert itself has no way to customize the Title and Description font and color.