知道有:
对于已有一个项目中:
先去试试使用:
https://github.com/hackiftekhar/IQKeyboardManager
github “hackiftekhar/IQKeyboardManager” |
试试:
licrifandeMacBook-Pro:Workhub crifan$ carthage update IQKeyboardManager –platform iOS *** Cloning IQKeyboardManager |
结果出错:
licrifandeMacBook-Pro:Workhub crifan$ carthage update IQKeyboardManager –platform iOS *** Cloning IQKeyboardManager *** Fetching SwiftHTTPStatusCodes *** Fetching PageMenu *** Fetching Kingfisher *** Fetching SwiftyJSON *** Fetching SwiftHEXColors *** Fetching SwiftKeychainWrapper *** Fetching Alamofire *** Fetching XCGLogger *** Fetching realm-cocoa *** Fetching Cartography *** Checking out IQKeyboardManager at “v4.0.4” *** xcodebuild output can be found in /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/carthage-xcodebuild.FaOqCW.log *** Building scheme “IQKeyboardManagerSwift” in IQKeyboardManager.xcodeproj *** Building scheme “IQKeyboardManager” in IQKeyboardManager.xcodeproj Failed to read file or folder at /Users/crifan/Library/Developer/Xcode/DerivedData/IQKeyboardManager-chnohoqoqmxkcwhebmkelfdqjckr/Build/Products/Release-iphoneos/IQKeyboardManager.framework |
但是此处的Carthage下面是存在的:
IQKeyboardManagerSwift.framework
和:
IQKeyboardManager.framework
然后去导入:
IQKeyboardManagerSwift.framework
试试
去尝试使用:
import IQKeyboardManagerSwift @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDelegate { var window: UIWindow? func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { IQKeyboardManager.sharedManager().enable = true return true } |
然后两次运行都报错。
然后clean后,多次尝试后运行,终于可以了:
但是很明显,多处一个Done
-》要想办法把Done去掉:
通过查看描述文档,好像是:
IQKeyboardManager的enableAutoToolbar
IQKeyboardManager.sharedManager().enableAutoToolbar = false |
果然就没了:
但是还有个问题:键盘上移期间,会出现一个黑色边框:
然后试了很多参数,都不行:
IQKeyboardManager.sharedManager().keyboardDistanceFromTextField = 20 // IQKeyboardManager.sharedManager().shouldToolbarUsesTextFieldTintColor = true |
swift keyboard moving up show black background
swift keyboard moving up show black
ios keyboard moving up show black
转载请注明:在路上 » [已解决]swift实现点击文本输入框时显示键盘后页面自动上移