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

Crash on UITextField Focus (Swift 3) #17

Closed
m-butler opened this issue Sep 24, 2016 · 2 comments
Closed

Crash on UITextField Focus (Swift 3) #17

m-butler opened this issue Sep 24, 2016 · 2 comments

Comments

@m-butler
Copy link

func keyboardDidShow(_ notification: Notification) {
        let info = (notification as NSNotification).userInfo
        let keyboardSize = ((info![UIKeyboardFrameBeginUserInfoKey] as AnyObject).cgRectValue.size)
        self.oldFrame = self.alertView.frame
        let extraHeight = (oldFrame.size.height + oldFrame.origin.y) - (self.view.frame.size.height - keyboardSize.height)
        if extraHeight > 0 {
            UIView.animate(withDuration: 0.3, animations: { () -> Void in
                self.alertView.frame = CGRect(x: self.oldFrame.origin.x, y: self.oldFrame.origin.y - extraHeight - 8, width: self.oldFrame.size.width, height: self.oldFrame.size.height)
            })
        }
    }

When focusing on a UITextField inside of a ZAlertView, the application crashes on this line:

let keyboardSize = ((info![UIKeyboardFrameBeginUserInfoKey] as AnyObject).cgRectValue.size)

The error reported is:

fatal error: unexpectedly found nil while unwrapping an Optional value

@m-butler m-butler changed the title Crash on UITextField Focus Crash on UITextField Focus (Swift 3) Sep 24, 2016
@Dileepyadav
Copy link

facing the same issue

@zelic91
Copy link
Owner

zelic91 commented Nov 14, 2016

Thanks for reporting. Please checkout version 0.3.3.

@zelic91 zelic91 closed this as completed Nov 14, 2016
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

3 participants