I'm Paolo and I work for Automattic as iOS Engineer!
pmusolino / pmalertcontroller Goto Github PK
View Code? Open in Web Editor NEWPMAlertController is a great and customizable alert that can substitute UIAlertController
License: MIT License
PMAlertController is a great and customizable alert that can substitute UIAlertController
License: MIT License
Hi
Can you implement "tap away" feature i.e. if the user taps outside of the PMAlert then to dismiss the Alert window.
Thanks in advance !
Hey!
I'm trying to setup the buttons in a horizontal manner. Since I've 2 buttons. But I couldn't make them horizontally aligned. Any suggestions?
extension FavoritesViewController {
func showAddUser() {
let alertVC = PMAlertController(title: "Add friend", description: "Please write down your friends username", image: nil, style: .alert)
alertVC.addTextField { (textField) in
textField?.placeholder = "Username..."
textField?.autocorrectionType = .no
textField?.autocapitalizationType = .none
}
alertVC.addAction(PMAlertAction(title: "Cancel", style: .cancel, action: { () in
}))
alertVC.addAction(PMAlertAction(title: "Add", style: .default, action: { () in
}))
self.present(alertVC, animated: true, completion: nil)
}
}
let alertController = PMAlertController(title: titleText, description: bodyText, image: image, style: .alert) alertController.gravityDismissAnimation = false alertController.alertTitle.tintColor = alertTitleColor alertController.alertDescription.tintColor = alertContentColor
When presented it shows the default colors
Hi,
I love this project however the disappearing animation does not suit my app. I need to change it to something like a fade out (or something else really). I could'n find any way to achieve this. Please help (Some example code would be appreciated)
I've implemented the pmalertcontroller with textfield
How could I get the value of the text input by the user ?
Thanks for gr8 library btw π
Hello,
Is there any way to customize the alertView font size and color for our app used?
Thank you very much.
I tried using a different alertMaskBackground image but that didn't work for me in dismissWithBackgroudTouch = true mode. Can you suggest workaround for it or implement it in future release?
Hello, I would like to change the background colour of a label when the user selects it. How can I do that?
Can we add a textfield just like the default alert controller?
It would be cool if the alertcontroller had the ability to rotate images or a native spinner option to offer feedback on lengthy tasks,
In the meanwhile I'll try to make my own with QuartzCore and add it as a pull request
Hi Codeido and thanks for your work!
There is a way to add a progress bar to the header view?
Hello,
I am looking for an AlertController, which can display a text like this:
http://www2.pic-upload.de/img/31474056/bornscreen.jpg
Headings with bigger font, usual text with smaller font, displaying URLs and so on. It's one big String with HTML-Code.
Can the description-attribute of PMAlertController also format a HTML-String? If yes, how?
Best regards
CocoaPods
and Carthage
are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.
It would be cool to add the Manual installation guide in your README.md
. You can take a look at my iOS Readme Template to see how you can do it.
Why did I get this error when running pod install command?
The dependency PMAlertController
is not used in any concrete target.
I'm using xcode 7.3 with objective-c project and pod version 1.0.0
Thanks in advance.
You can't scroll down if the number of alert actions are more than what the screen allows
Requirements
iOS 9.0+
if it can down to iOS8, it will be more greater~ π
the ios version must 9.0?
Hey @codeido,
I'd love to help PMAlertController to be ported to Swift 3. Can we create a new branch for that?
Hello,
I am building a popup to login in my app, is there a way to prevent the popup to close, in order to tell the user that le credentials are wrong without showing another login popup ?
I'm working with google maps the PMAlertController hides behind the map what could do to get it front? I'm stuck here.
For some reason, I am not using use_frameworks!, but use_modular_headers! instead.
Then it comes with error:
Unable to run command 'StripNIB PMAlertController.nib' - this target might include its own product.
Unable to run command 'StripNIB PMAlertController~iphone.nib' - this target might include its own product.
Unable to run command 'StripNIB PMAlertController~ipad.nib' - this target might include its own product.
Hi! How do we change the font face and colors for the default and cancel styles?
I have 3 tab bar items with 3 different view controller.
And I use PMAlertController for the first tab item, it works great but whenever I select another tab item and go back to the first one it gives black screen.
I think it may relate to super views and order of views .
Thanks in advance for the great library.
Are there plans to provide an update for Xcode 10 ?
I tried to add the keyboard type as "emailAddress" and it doesn't work. It'd be an interest feature.
Can't call method init with objectiv-c.
any issue?
ει’γ
Hi this is an awesome library. Im using it since swift 3 for almost my whole project.
Now im using swift 4 version and run into some trouble.
alertVC.dismiss(animated: false, completion: { () in self.dismiss(animated: true, completion: nil) })
In swift 3 version, the completion block run well. However, after upgrade to swift 4, the completion block did not called. Please help me :D
Hi!
I'm trying to change the background color of the alert - can i achieve this with the property "alertMaskBackground"? If so... then it doesn't work - or maybe I don't know how to use it. Can You post some example?
Thanks for the great lib!
When will be released a version with Swift4?
I have install PMAlertController in version 1.1.0 in Xcode 7.3 and Deployment target is 9.0 but the issue is something like this :
"This Version does not support documents save in the Xcode 8 format. Open this document with Xcode 8.0 or later."
I would like to update the image after some time (progress result)
How to do that ?
I try to update image but it does not work
Couldn't make divider invisible with any of these methods, neither change the color :/
action.isDividerHidden = true
alert.alertActionStackView.isDividerHidden = true
alert.alertActionStackView.arrangedSubviews[0].isDividerHidden = true
Hi
I love the library but I don't think it has Swift 3 support as Xcode 8 is telling me that I need to do a lot of changes.
for example:
//MARK: - Customizations
@objc private func setShadowAlertView(){
alertView.layer.masksToBounds = false
alertView.layer.shadowOffset = CGMake(0,0) and should be CGSize(width: 0, height: 0)
alertView.layer.shadowRadius = 8
alertView.layer.shadowOpacity = 0.3
}
What I'm missing ?
I wanted to use PMAlertAction
to imitate UIAlertController
, with one difference, that is the ability to show an image above the title. However, I ran into multiple problems when trying to subclass.
PMAlertAction
is marked as an open class
signing that it should be welcoming to subclassing, but the problem is for example, PMAlertActionStyle
is limited to 2 cases, default
and cancel
but I want to imitate the behaviour of the standard UIAlertController
which means I also need destructive
.
Even if I wanted to replace PMAlertActionStyle
with my own enum, I couldn't since actionStyle
is a must have for initialisation.
In addition addSeperator
and tapped
are internal, so if I don't want to re-write them, I must use the convenience initialiser, which again takes a PMAlertActionStyle
and is also extremely "Opinionated" about the design. I wonder what other people do? since I see no choice but forking it and replacing the enum with my own.
It also seems to only be used in 2 places, the init
to determine the titleColor
and in the animateDismissWithGravity
.
I would suggest PMAlertActionStyleType
should be a protocol with a var titleColor
and var animationStyle
. PMAlertActionStyle
can confirm to it, maintaining backwards compatibility. While letting other people extend it as needed, as expected from a UI framework.
I am of course aware that I can just crate a PMAlertAction
, ignore the PMAlertActionStyle
, change whatever I need in it and then return it, but it seems a little weird to do. Maybe it would make more sense if the PMAlertActionStyle
had followed UIAlertController and had destructive
with a default implementation the looked exactly like UIAlertController, so that a person could use a PMAlertController
as plug and play replacement for for UIAlertController
. However, as it stands with the yellow title and pinkish red button, it only fits into very specific designs and forces any user to customise it.
Otherwise though, I think it's really great, and a much needed framework, with UIAlertController being so rigid.
Is it possible to customize the font size, and colours?
thanks.
If the alert text cannot fit on the screen the text cannot be scrolled - UIAlertController in contrast supports scrolling by default. What's worse is that the PMAlertController places the "cancel" action off the screen so a user cannot then cancel the alert. The App is effectively blocked from user interaction.
Being able to handle an alert that wont fit completely on screen is important. With devices with different configurations (e.g. screen sizes, portrait, landscape) and dynamic type sizes (i.e. through the settings App a user can increase the text size) its easy to imagine some alerts not fitting a screen.
Otherwise a great library thanks!
Hi, There is a away to customize the alerts once for everyone and not in every single call, Title font, color, action color and font ?
A UIView is more flexible for show dynamic information besides the title and text.
The height of header view could be flexible.
Thanks for the great library!
I use PMAlertController in my code but have my own alert queue manager for handling an alert queue, I need to get notified whenever an alert is dismissed. Can you guys add the following code to the viewDidDisappear in the PMAlertController?
NotificationCenter.default.post(name: NSNotification.Name.init("PMAlertDismissed"), object: nil)
Thanks
I dragged the /Library folder to the Project Navigation.
Then added this code:
let alertVC = PMAlertController(title: "A Title", description: "My Description", image: UIImage(named: "img.png"), style: .Alert)
alertVC.addAction(PMAlertAction(title: "Cancel", style: .Cancel, action: { () -> Void in
print("Capture action Cancel")
}))
alertVC.addAction(PMAlertAction(title: "OK", style: .Default, action: { () in
print("Capture action OK")
}))
self.presentViewController(alertVC, animated: true, completion: nil)
to my ViewController.
However, I get this error:
Use of unresolved identifier 'PMAlertController'
Is subj possible?
I think that I found a little bug
If You Call two alert in sequence:
First alert->ok call->second alert
the second alert disappear immediately and block the app with the only maskbackground visible.
If you delay the second alert call this don't happen.
Hope that my explanation is clear.
Hi, I am experienced an issue.
Now when i load the view the image is to the right not centered as before, the text is correct but not the imagen, what could be wrong?.
thanks
objc classes cannot dismiss the alert without the gravityanimation. Also, it's not possible, from objc, to dismiss the alert touching on the background.
When presenting the alert view controller, if it is dismissed, and showed again it does not work. Below an example of the code.
let alertController = PMAlertController(title: "Register Sensor", description: String(format: "Please enter the activation code and owner's email of the %@ sensor", arguments: [serialNumber]), image: nil, style: .alert)
alertController.addTextField({ (textField) -> Void in
textField?.placeholder = "Activation Code"
textField?.textAlignment = .center
})
alertController.addTextField({ (textField) -> Void in
textField?.placeholder = "Owner's Email"
textField?.keyboardType = .emailAddress
textField?.textAlignment = .center
})
alertController.addAction(PMAlertAction(title: "Save", style: .default, action: {
() -> Void in
let activationCode = alertController.textFields[0] as UITextField
let ownerEmail = alertController.textFields[1] as UITextField
if let code = activationCode.text, let email = ownerEmail.text, code != "", email != "" {
self.activateSensor(serialNumber: serialNumber, code: code, owner: email, returnCompletion: {
(success, object) -> Void in
if success {
self.getSensors(true)
} else {
let error = object as? String
AlertView.alert(view: self, "Error", message: error ?? "", completion: {
(alert) -> Void in
self.present(alertController, animated: true, completion: nil)
})
}
});
} else {
AlertView.alert(view: self, "Error", message: "Please input both activation code and owner's email", completion: {
(alert) -> Void in
self.present(alertController, animated: true, completion: nil)
})
}
}))
alertController.addAction(PMAlertAction(title: "Cancel", style: .cancel, action: nil))
self.present(alertController, animated: true, completion: nil)
Hi,
thanks for this nice controller!
If I use lines of code like this:
alertVC.addAction(PMAlertAction(title: "Only selected supporters.", style: .cancel, action: { () in
self.performSegue(withIdentifier: "pickA", sender: self)
}))
The controller pops up and in less then 1 second is dismissing.
Is there a way to avoid this behavior?
Thank you
Michele
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.