Skip to content

Commit

Permalink
Merge pull request TeamNADA#59 from hyun99999/feature/TeamNADA#57
Browse files Browse the repository at this point in the history
[ADD] TeamNADA#57 - IQKeyboardManager 라이브러리 추가 및 설정
  • Loading branch information
hyun99999 authored Nov 10, 2021
2 parents 350f000 + 772b3cb commit 5cf980f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 38 deletions.
6 changes: 6 additions & 0 deletions NADA-iOS-forRelease/Sources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit
import IQKeyboardManagerSwift

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand All @@ -23,6 +24,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
window?.rootViewController = UIStoryboard(name: Const.Storyboard.Name.customTabBar, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.customTabBarController)
// window?.rootViewController = TabBarViewController()
window?.makeKeyAndVisible()


IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.enableAutoToolbar = false
IQKeyboardManager.shared.shouldResignOnTouchOutside = true
}

func sceneDidDisconnect(_ scene: UIScene) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ class CardCreationViewController: UIViewController {
setUI()
registerCell()
setNotification()
touchViewToDownKeyboard()
initRestoreFrameYValue()
setTextLabelGesture()

// TODO: 서버통신 테스트 중. 추후 호출 위치 변경.
// FIXME: 서버통신 테스트 중. 추후 호출 위치 변경.
// cardDetailFetchWithAPI(cardID: "cardA")
// let cardCreationRequest = CardCreationRequest(userID: "nada",
// defaultImage: 0,
Expand All @@ -61,7 +59,7 @@ class CardCreationViewController: UIViewController {
// twoAnswer: "루삥뽕")
// cardCreationWithAPI(request: cardCreationRequest, image: UIImage(systemName: "circle")!)

// TODO: group.서버통신 테스트 중. 추후 호출 위치 변경.
// FIXME: group.서버통신 테스트 중. 추후 호출 위치 변경.
// let changeGroupRequest = ChangeGroupRequest(cardID: "cardA",
// userID: "nada2",
// groupID: 3,
Expand Down Expand Up @@ -128,15 +126,6 @@ extension CardCreationViewController {
private func setNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(setFrontCardIsEmpty(_:)), name: .frontCardtextFieldIsEmpty, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(setbackCardIsEmpty(_:)), name: .backCardtextFieldIsEmpty, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(showKeyboard(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(hideKeyboard(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
private func touchViewToDownKeyboard() {
let tapGesture = UITapGestureRecognizer(target: self.view, action: #selector(self.view.endEditing(_:)))
self.view.addGestureRecognizer(tapGesture)
}
private func initRestoreFrameYValue() {
restoreFrameYValue = self.view.frame.origin.y
}
private func setTextLabelGesture() {
let tapFrontTextLabelGesture = UITapGestureRecognizer(target: self, action: #selector(dragToFront))
Expand All @@ -153,38 +142,31 @@ extension CardCreationViewController {
}
// if frontCardIsEmpty == true && backCardIsEmpty == true {
if frontCardIsEmpty == true {
completeButton.backgroundColor = .inputBlack2
completeButton.setTitleColor(.hintGray1, for: .normal)
completeButton.isUserInteractionEnabled = false
// TODO: - 버튼설정
// completeButton.backgroundColor = .inputBlack2
// completeButton.setTitleColor(.hintGray1, for: .normal)
// completeButton.isUserInteractionEnabled = false
} else {
completeButton.backgroundColor = .mainBlue
completeButton.setTitleColor(.white1, for: .normal)
completeButton.isUserInteractionEnabled = true
// completeButton.backgroundColor = .mainBlue
// completeButton.setTitleColor(.white1, for: .normal)
// completeButton.isUserInteractionEnabled = true
}
}
@objc
func setbackCardIsEmpty(_ notification: Notification) {
if let isEmpty = notification.object as? Bool {
backCardIsEmpty = isEmpty
}
print("backCardIsEmpty : \(backCardIsEmpty)")
}
@objc
func showKeyboard(_ notification: Notification) {
if self.view.frame.origin.y == restoreFrameYValue {
if let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue {
let keyboardHeight = keyboardFrame.cgRectValue.height
self.view.frame.origin.y -= keyboardHeight
}
}
}
@objc
private func hideKeyboard(_ notification: Notification) {
if self.view.frame.origin.y != restoreFrameYValue {
if let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue {
let keyboardHeight = keyboardFrame.cgRectValue.height
self.view.frame.origin.y += keyboardHeight
}
// if frontCardIsEmpty == true && backCardIsEmpty == true {
if backCardIsEmpty == true {
// TODO: - 버튼설정
// completeButton.backgroundColor = .inputBlack2
// completeButton.setTitleColor(.hintGray1, for: .normal)
// completeButton.isUserInteractionEnabled = false
} else {
// completeButton.backgroundColor = .mainBlue
// completeButton.setTitleColor(.white1, for: .normal)
// completeButton.isUserInteractionEnabled = true
}
}
@objc
Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ pod 'SkeletonView'
pod 'SwiftLint'
pod 'VerticalCardSwiper'
pod 'KakaoSDKUser'
pod 'IQKeyboardManagerSwift'
end
6 changes: 5 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PODS:
- Alamofire (5.4.4)
- IQKeyboardManagerSwift (6.5.6)
- KakaoSDKAuth (2.8.2):
- KakaoSDKCommon (= 2.8.2)
- KakaoSDKCommon (2.8.2):
Expand All @@ -20,6 +21,7 @@ PODS:
- VerticalCardSwiper (2.3.1)

DEPENDENCIES:
- IQKeyboardManagerSwift
- KakaoSDKUser
- Moya (~> 14.0)
- SkeletonView
Expand All @@ -29,6 +31,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- Alamofire
- IQKeyboardManagerSwift
- KakaoSDKAuth
- KakaoSDKCommon
- KakaoSDKUser
Expand All @@ -39,6 +42,7 @@ SPEC REPOS:

SPEC CHECKSUMS:
Alamofire: f3b09a368f1582ab751b3fff5460276e0d2cf5c9
IQKeyboardManagerSwift: c7df9d2deb356c04522f5c4b7b6e4ce4d8ed94fe
KakaoSDKAuth: 2b7e6998d7028cabd037ef8d0d2f987b4eec9f89
KakaoSDKCommon: 1b5dc1c785688bed6d6747d05f2c8e08420f09ff
KakaoSDKUser: 937f1acc1380192d38483480d5bf01b141471829
Expand All @@ -47,6 +51,6 @@ SPEC CHECKSUMS:
SwiftLint: e5c7f1fba68eccfc51509d5b2ce1699f5502e0c7
VerticalCardSwiper: 68df635b354500f86934ea044ade37a264c044c6

PODFILE CHECKSUM: ed90d25629de2c0d09e14aa4277ccf85ccb9037a
PODFILE CHECKSUM: 176ec86a8b34d679a9bdc17fac73e683359a616f

COCOAPODS: 1.11.2

0 comments on commit 5cf980f

Please sign in to comment.