Skip to content

Commit

Permalink
Merge pull request #160 from mbutan/master
Browse files Browse the repository at this point in the history
Problem with more than one input field
  • Loading branch information
vikmeup committed Apr 16, 2016
2 parents e982fba + 44790e8 commit ed7311b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions SCLAlertView/SCLAlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ public class SCLAlertView: UIViewController {
var keyboardHasBeenShown:Bool = false

func keyboardWillShow(notification: NSNotification) {
guard !keyboardHasBeenShown else {return}
keyboardHasBeenShown = true

guard let userInfo = notification.userInfo else {return}
Expand All @@ -374,16 +375,16 @@ public class SCLAlertView: UIViewController {
}

func keyboardWillHide(notification: NSNotification) {
if(keyboardHasBeenShown){//This could happen on the simulator (keyboard will be hidden)
if(self.tmpContentViewFrameOrigin != nil){
self.contentView.frame.origin.y = self.tmpContentViewFrameOrigin!.y
}
if(self.tmpCircleViewFrameOrigin != nil){
self.circleBG.frame.origin.y = self.tmpCircleViewFrameOrigin!.y
}

keyboardHasBeenShown = false
guard keyboardHasBeenShown else {return} //This could happen on the simulator (keyboard will be hidden)

if(self.tmpContentViewFrameOrigin != nil){
self.contentView.frame.origin.y = self.tmpContentViewFrameOrigin!.y
}
if(self.tmpCircleViewFrameOrigin != nil){
self.circleBG.frame.origin.y = self.tmpCircleViewFrameOrigin!.y
}

keyboardHasBeenShown = false
}

//Dismiss keyboard when tapped outside textfield & close SCLAlertView when hideWhenBackgroundViewIsTapped
Expand Down

0 comments on commit ed7311b

Please sign in to comment.