Skip to content
New issue

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

giphyControllerDidCancel not getting called #14

Open
raghavAdplay opened this issue Apr 16, 2019 · 0 comments
Open

giphyControllerDidCancel not getting called #14

raghavAdplay opened this issue Apr 16, 2019 · 0 comments

Comments

@raghavAdplay
Copy link

Hi, I am trying out this library with swift 4.2. It works fine so far except that giphyControllerDidCancel doesn't get called. giphyControllerDidSelectGif works fine though.

Here's my code.
class DPChatController: UIViewController, SwiftyGiphyViewControllerDelegate{

func giphyControllerDidSelectGif(controller: SwiftyGiphyViewController, item: GiphyItem) {
    
    if let gifDownSized = item.downsizedImage {
        //detailImageView.sd_setImage(with: gifDownSized.url)
    }
    
    // close gif selection controller via delegate. This doesn't work!
    print("Am in Did Select gif")
    //controller.dismiss(animated: true)
    self.navigationController?.popViewController(animated: true)
    self.inputBar.isHidden = false
}

func giphyControllerDidCancel(controller: SwiftyGiphyViewController) {
    print("Am in Did Cancel")
    self.navigationController?.popViewController(animated: true)
    self.inputBar.isHidden = false
}

@IBAction func chooseProfileActions(_ sender: Any) {
messageTxt.resignFirstResponder()
inputBar.isHidden = true
let profileOptions = UIAlertController(title: "Choose options", message: "", preferredStyle: .actionSheet)
profileOptions.addAction(UIAlertAction(title: "Library", style: .default, handler: { (UIAlertAction) in
self.openPhotoLibrary(isPhoto: false)
}))
profileOptions.addAction(UIAlertAction(title: "Camera", style: .default, handler: { (UIAlertAction) in
self.openPhotoLibrary(isPhoto: true)
}))
profileOptions.addAction(UIAlertAction(title: "GIF", style: .default, handler: { (UIAlertAction) in
self.giphy.navigationController?.delegate = self
self.giphy.delegate = self
self.navigationController?.pushViewController(self.giphy, animated: true)
}))
profileOptions.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (UIAlertAction) in
print("User selected Cancel option")
self.inputBar.isHidden = false
})
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant