Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

When i run the sample,it got errors from the keyboardManager ,i am not good at swift ,how should i tackle with it ? #45

Closed
KKKiller opened this issue Apr 18, 2016 · 7 comments

Comments

@KKKiller
Copy link

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(KeyboardManager.keyboardWillShowOrHide(_:)), name: UIKeyboardWillShowNotification, object: nil)

error: missing argument for parameter 'selector' in call

@jesiegel1
Copy link
Collaborator

what version of Xcode are you using?

@KKKiller
Copy link
Author

7.2.1

@jesiegel1
Copy link
Collaborator

The selector syntax is different for Swift 2.2. For your version, you should use NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("KeyboardManager.keyboardWillShowOrHide:"), name: UIKeyboardWillShowNotification, object: nil)

@cjwirth
Copy link
Owner

cjwirth commented Apr 18, 2016

The syntax for selectors was improved in Swift 2.2, and Xcode 7.3. Since Xcode 7.3 official was released, I upgraded the sample project to be run on 7.3 instead of 7.2.

If you still want to run it on 7.2, you can change it from #selector(KeyboardManager.keyboardWillShowOrHide(_:)) to Selector("keyboardWillShorOrHide:") and it should work. (I didn't try it, so the syntax might be wrong, but you need to use string-based selectors rather than the new ones)

@KKKiller
Copy link
Author

it success when i run on 7.3,but it was not scroll when the word is under the keyboard,

@jesiegel1
Copy link
Collaborator

jesiegel1 commented Apr 18, 2016

because the fix for that bug hasn't been merged yet, it's a wip. please see pull req #34

@cjwirth
Copy link
Owner

cjwirth commented Apr 18, 2016

it success when i run on 7.3

Awesome, closing this issue then 👍

but it was not scroll when the word is under the keyboard

I made a comment in pull request #34 so you can use the in-progress version of the project that should be fixed. It'd be great if you could use it and make sure it works before we merge it in!

@cjwirth cjwirth closed this as completed Apr 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants