본문 바로가기

Ios/Libraries

Ios - textField 가리지 않게 keyboard를 조작하는 법

IQKeyboardManager라는 강력한 라이브러리를 사용하면 된다!

https://github.com/hackiftekhar/IQKeyboardManager

 

import IQKeyboardManagerSwift // 라이브러리를 임포트하고

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

      IQKeyboardManager.shared.enable = true // 옆의 코드를 써주면 끝!
      //IQKeyboardManager.shared.enableAutoToolbar = false 툴바를 없에고 싶을 때
      //IQKeyboardManager.shared.shouldResignOnTouchOutside = true 텍스트 필드 이외의 부분을 터치하면 키보드를 사라지게 하고 싶을 때



      return true
    }
}

 

'Ios > Libraries' 카테고리의 다른 글

IOS - 간단한 Swift Lottie 라이브러리 사용법  (0) 2019.12.06