We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thank you for creating SDCAlertView. It enables us to create UIAlertController liked custom view.
SDCAlertView
UIAlertController
I was wondering, is it possible, to animate the height of contentView? Currently, this is what I have done so far.
contentView
import UIKit import SDCAlertView class ViewController: UIViewController { var heightConstraint: NSLayoutConstraint! var alert: AlertController! func selectClicked() { UIView.animate(withDuration: 2) { self.heightConstraint.constant = 200 self.alert.contentView.layoutIfNeeded() } } func customClicked() { UIView.animate(withDuration: 2) { self.heightConstraint.constant = 300 self.alert.contentView.layoutIfNeeded() } } @IBAction func buttonClicked(_ sender: Any) { print("button clicked") let customView = CustomView.instanceFromNib() self.alert = AlertController(title: "Title", message: nil, preferredStyle: .actionSheet) alert.contentView.addSubview(customView) alert.contentView.backgroundColor = UIColor(red: 0.5, green: 0, blue: 0, alpha: 0.1) customView.translatesAutoresizingMaskIntoConstraints = false alert.contentView.translatesAutoresizingMaskIntoConstraints = false customView.heightAnchor.constraint(equalTo: alert.contentView.heightAnchor).isActive = true customView.bottomAnchor.constraint(equalTo: alert.contentView.bottomAnchor).isActive = true customView.leadingAnchor.constraint(equalTo: alert.contentView.leadingAnchor).isActive = true customView.trailingAnchor.constraint(equalTo: alert.contentView.trailingAnchor).isActive = true self.heightConstraint = alert.contentView.heightAnchor.constraint(equalToConstant: 300) self.heightConstraint.isActive = true // So that we can receive buttons click event. customView.viewController = self alert.addAction(AlertAction(title: "Cancel", style: .normal)) alert.present() } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } }
Here's the outcome - https://www.youtube.com/watch?v=wg1oEVME4HE
The "parent" of contentView not able to "follow" and animation height change of contentView. The "parent" just change its own height abruptly.
Is there a way, to make the "parent" of contentView also able to animate its own height gracefully?
Thanks.
The text was updated successfully, but these errors were encountered:
Hi,
I able to "solve" the issue by
UIView.animate(withDuration: 2) { self.heightConstraint.constant = 300 self.alert.contentView.layoutIfNeeded() }
to
UIView.animate(withDuration: 2) { self.heightConstraint.constant = 300 self.alert.view.layoutIfNeeded() }
Sorry, something went wrong.
No branches or pull requests
Thank you for creating
SDCAlertView
. It enables us to createUIAlertController
liked custom view.I was wondering, is it possible, to animate the height of
contentView
? Currently, this is what I have done so far.Here's the outcome - https://www.youtube.com/watch?v=wg1oEVME4HE
The "parent" of
contentView
not able to "follow" and animation height change ofcontentView
. The "parent" just change its own height abruptly.Is there a way, to make the "parent" of contentView also able to animate its own height gracefully?
Thanks.
The text was updated successfully, but these errors were encountered: