浏览代码

键盘完成

南鑫林 5 年之前
父节点
当前提交
56bc75f88c
共有 16 个文件被更改,包括 186 次插入479 次删除
  1. 2 1
      RainbowPlanet/Podfile
  2. 15 1
      RainbowPlanet/Podfile.lock
  3. 0 4
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  4. 5 18
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  5. 2 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift
  6. 6 13
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  7. 5 10
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  8. 4 11
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift
  9. 7 10
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/ViewController/CommunitySubCommentController.swift
  10. 6 10
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityAllCommentView.swift
  11. 6 11
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoSubCommentController/CommunityVideoSubCommentController.swift
  12. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/comments_pic_bg.imageset/Contents.json
  13. 二进制
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/comments_pic_bg.imageset/comments_pic_bg@2x.png
  14. 二进制
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/comments_pic_bg.imageset/comments_pic_bg@3x.png
  15. 0 193
      RainbowPlanet/RainbowPlanet/Tools/KeyBoardCommentView/KeyBoardCommentView.swift
  16. 106 197
      RainbowPlanet/RainbowPlanet/Tools/KeyBoardCommentView/KeyBoardInputView.swift

+ 2 - 1
RainbowPlanet/Podfile

@@ -27,6 +27,7 @@ target 'RainbowPlanet' do
   # 自动布局
   pod 'SnapKit'
   # 键盘
+  pod 'InputBarAccessoryView'
   pod 'IQKeyboardManagerSwift'
   # 弹框
   pod 'MBProgressHUD'
@@ -63,7 +64,7 @@ target 'RainbowPlanet' do
   
   pod 'ESTabBarController-swift'
   # 内存泄露
-#  pod 'MLeaksFinder'
+  pod 'MLeaksFinder'
 
 
   #======================第三方平台===========

+ 15 - 1
RainbowPlanet/Podfile.lock

@@ -28,6 +28,7 @@ PODS:
   - EFQRCode (5.0.0):
     - swift_qrcodejs (~> 1.1.1)
   - ESTabBarController-swift (2.7)
+  - FBRetainCycleDetector (0.1.4)
   - FlickerNumber (1.1)
   - FMDB (2.7.5):
     - FMDB/standard (= 2.7.5)
@@ -36,6 +37,9 @@ PODS:
   - FWPopupView (4.0.7):
     - SnapKit
   - Gifu (3.2.0)
+  - InputBarAccessoryView (4.3.1):
+    - InputBarAccessoryView/Core (= 4.3.1)
+  - InputBarAccessoryView/Core (4.3.1)
   - IQKeyboardManagerSwift (6.4.0)
   - JSONModel (1.7.0)
   - JXSegmentedView (0.0.19)
@@ -45,6 +49,8 @@ PODS:
   - LYEmptyView (1.2.5)
   - MBProgressHUD (1.1.0)
   - MJRefresh (3.2.0)
+  - MLeaksFinder (1.0.0):
+    - FBRetainCycleDetector
   - Moya/Core (13.0.1):
     - Alamofire (~> 4.1)
     - Result (~> 4.1)
@@ -110,6 +116,7 @@ DEPENDENCIES:
   - FSPagerView
   - FWPopupView
   - Gifu
+  - InputBarAccessoryView
   - IQKeyboardManagerSwift
   - JSONModel (~> 1.7.0)
   - JXSegmentedView
@@ -119,6 +126,7 @@ DEPENDENCIES:
   - LYEmptyView
   - MBProgressHUD
   - MJRefresh
+  - MLeaksFinder
   - Moya/RxSwift
   - ObjectMapper
   - pop
@@ -157,11 +165,13 @@ SPEC REPOS:
     - DPScrollNumberLabel
     - EFQRCode
     - ESTabBarController-swift
+    - FBRetainCycleDetector
     - FlickerNumber
     - FMDB
     - FSPagerView
     - FWPopupView
     - Gifu
+    - InputBarAccessoryView
     - IQKeyboardManagerSwift
     - JSONModel
     - JXSegmentedView
@@ -171,6 +181,7 @@ SPEC REPOS:
     - LYEmptyView
     - MBProgressHUD
     - MJRefresh
+    - MLeaksFinder
     - Moya
     - ObjectMapper
     - pop
@@ -207,11 +218,13 @@ SPEC CHECKSUMS:
   DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
   EFQRCode: 07437cfbce3a1e497397a4f3d766c980d8972608
   ESTabBarController-swift: 4fb52ad03d94d0717ef97bc9eb09a5abfdded0a2
+  FBRetainCycleDetector: 46f8179bbb1c587deee3ea838a1a3ee02acf5015
   FlickerNumber: bce41da51904d533393d69e9734df6281ab1c646
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
   FSPagerView: 816a18842306973cc7cc6df8a5332272f7815c30
   FWPopupView: c1dbb33fbe4d223f619f28a7e5e5a00f08c10342
   Gifu: 7bcb6427457d85e0b4dff5a84ec5947ac19a93ea
+  InputBarAccessoryView: 58a348be7ea2736c7eec60e5c315511c2dbb39fd
   IQKeyboardManagerSwift: ed9b04ee0e3067ffba543283462d619f944b05e5
   JSONModel: 840bc0fcffb24b8454d2c026bf26fea454b8e98d
   JXSegmentedView: 6e22381bd1e6f0767fc078bef1947b13b2d337a1
@@ -221,6 +234,7 @@ SPEC CHECKSUMS:
   LYEmptyView: b17adfc2dd9ad2988ecaf7c9606efa916e24c767
   MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
   MJRefresh: ed450d6eb9d3346a2cb033ab7eb6de090aeef437
+  MLeaksFinder: 8c435bd2f6d070af18cff082b503b21adc130fc0
   Moya: f4a4b80ff2f8a4ffc208dfb31cd91636622fee6e
   ObjectMapper: 70187b8941977c62ccfb423caf6b50be405cabf0
   pop: d582054913807fd11fd50bfe6a539d91c7e1a55a
@@ -244,6 +258,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: dde03b8404ebfe7d3c71d9c71b566546a5a93c5c
+PODFILE CHECKSUM: a3a9e9aac1a6f67c23d361f7e4e0de1b154b233f
 
 COCOAPODS: 1.7.4

+ 0 - 4
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -110,7 +110,6 @@
 		A7284A7322546460000BAEC4 /* SwiftMoyaServicePayApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7284A7222546460000BAEC4 /* SwiftMoyaServicePayApi.swift */; };
 		A7284A75225465DD000BAEC4 /* SwiftMoyaNetWorkServicePay.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7284A74225465DD000BAEC4 /* SwiftMoyaNetWorkServicePay.swift */; };
 		A7284A7722547333000BAEC4 /* AlipayResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7284A7622547333000BAEC4 /* AlipayResultModel.swift */; };
-		A7297C6622D72FA4001A7AE6 /* KeyBoardCommentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7297C6522D72FA4001A7AE6 /* KeyBoardCommentView.swift */; };
 		A729B5A82266F2E0004AE098 /* AlertSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A729B5A72266F2E0004AE098 /* AlertSheetView.swift */; };
 		A729B5AA2266F6FD004AE098 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A729B5A92266F6FD004AE098 /* Launch Screen.storyboard */; };
 		A729B5AD2266FF45004AE098 /* BindPhoneNumberView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A729B5AC2266FF45004AE098 /* BindPhoneNumberView.swift */; };
@@ -821,7 +820,6 @@
 		A7284A7222546460000BAEC4 /* SwiftMoyaServicePayApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaServicePayApi.swift; sourceTree = "<group>"; };
 		A7284A74225465DD000BAEC4 /* SwiftMoyaNetWorkServicePay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServicePay.swift; sourceTree = "<group>"; };
 		A7284A7622547333000BAEC4 /* AlipayResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlipayResultModel.swift; sourceTree = "<group>"; };
-		A7297C6522D72FA4001A7AE6 /* KeyBoardCommentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyBoardCommentView.swift; sourceTree = "<group>"; };
 		A729B5A72266F2E0004AE098 /* AlertSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertSheetView.swift; sourceTree = "<group>"; };
 		A729B5A92266F6FD004AE098 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
 		A729B5AC2266FF45004AE098 /* BindPhoneNumberView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BindPhoneNumberView.swift; sourceTree = "<group>"; };
@@ -2236,7 +2234,6 @@
 		A7297C6422D72F7F001A7AE6 /* KeyBoardCommentView */ = {
 			isa = PBXGroup;
 			children = (
-				A7297C6522D72FA4001A7AE6 /* KeyBoardCommentView.swift */,
 				A70DE55122E7E53F009E06BE /* KeyBoardInputView.swift */,
 			);
 			path = KeyBoardCommentView;
@@ -6190,7 +6187,6 @@
 				A7778CB82244E97A00C7C47A /* BindPhoneNumberViewController.swift in Sources */,
 				A754150F224CACF9002480B5 /* SwiftSign.swift in Sources */,
 				A71AF0BA226F00F8001730FE /* SearchResultView.swift in Sources */,
-				A7297C6622D72FA4001A7AE6 /* KeyBoardCommentView.swift in Sources */,
 				A77F2CB52232010F001BD3F6 /* ShoppingMallViewController.swift in Sources */,
 				A7D77DEB22DDC5900048D5F6 /* RedemptionAreaFSPagerViewCell.swift in Sources */,
 				A7D07CD622B78BC300186014 /* PersonViewUserAndOtherListCollectionViewCell.swift in Sources */,

+ 5 - 18
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -20,7 +20,6 @@ class CommunityFollowViewController: UIViewController {
     
     var communityFollowDataModels = Array<CommunityFollowDataModel>()
     var communityFollowDataModel : CommunityFollowDataModel?
-    var keyBoardCommentView : KeyBoardCommentView?
     /// 关注数组
     var cmsMemberModels = Array<CMSMemberModel>()
     
@@ -157,25 +156,13 @@ class CommunityFollowViewController: UIViewController {
     
     /// 显示键盘
     func showKeyBoardCommentView() {
-        keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(sendClosure: {
-            [weak self] text in
+        
+        KeyBoardInputView.show(inputViewResultClosure: {
+            [weak self] (text) in
             self?.communityPostCommentApi(text: text, complete: {
-                self?.keyBoardCommentView?.dismisskeyBoardCommentView()
+                self?.communityFollowDataModel = nil
             })
-        })
-//        KeyBoardInputView.show(inputViewResultClosure: {
-//            [weak self] (text) in
-//            self?.communityPostCommentApi(text: text, complete: {
-//                self?.communityFollowDataModel = nil
-//            })
-//        }, dismissClosure: {
-//            [weak self] in
-//            self?.communityFollowDataModel = nil
-//        })
-    }
-    /// 隐藏键盘
-    func hiddenKeyBoardCommentView() {
-        keyBoardCommentView?.hiddenViewClosure =  {
+        }) {
             [weak self] in
             self?.communityFollowDataModel = nil
         }

+ 2 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift

@@ -87,6 +87,8 @@ class CommunityViewController: BaseViewController {
         communityNavigationBarView.rightButtonClosure = {
             [weak self] in
             self?.reloadSegmentedStarView()
+
+            
         }
         
         // 找朋友 查看全部推荐关注

+ 6 - 13
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift

@@ -21,7 +21,6 @@ class CommunityRecommnendViewController: UIViewController {
     var communityRecommendDataModels = Array<CommunityRecommendDataModel>()
     /// 评论需要的模型
     var communityRecommendDataModel : CommunityRecommendDataModel?
-    var keyBoardCommentView : KeyBoardCommentView?
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -149,23 +148,18 @@ class CommunityRecommnendViewController: UIViewController {
     
     /// 显示键盘
     func showKeyBoardCommentView() {
-        keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(sendClosure: {
-            [weak self] text in
+        
+        KeyBoardInputView.show(inputViewResultClosure: {
+             [weak self] (text) in
             self?.communityPostCommentApi(text: text, complete: {
-                self?.keyBoardCommentView?.dismisskeyBoardCommentView()
+                [weak self] in
+                self?.communityRecommendDataModel = nil
             })
-        })
-    }
-    /// 隐藏键盘
-    func hiddenKeyBoardCommentView() {
-        keyBoardCommentView?.hiddenViewClosure =  {
+        }) {
             [weak self] in
             self?.communityRecommendDataModel = nil
         }
     }
-    
-    
-    
 }
 
 extension CommunityRecommnendViewController {
@@ -349,7 +343,6 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
                     [weak self] in
                     self?.communityRecommendDataModel = self?.communityRecommendDataModels[indexPath.section]
                     self?.showKeyBoardCommentView()
-                    self?.hiddenKeyBoardCommentView()
                 }
                 return cell
             default:

+ 5 - 10
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -20,7 +20,6 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     var id : Int = 0
     var communityRecommendDataModels = Array<CommunityRecommendDataModel>()
     var communityTopicDetailModel : CommunityTopicDetailModel?
-    var keyBoardCommentView : KeyBoardCommentView?
     
     /// 评论需要的模型
     var communityRecommendDataModel : CommunityRecommendDataModel?
@@ -255,16 +254,13 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     
     /// 显示键盘
     func showKeyBoardCommentView() {
-        keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(sendClosure: {
-            [weak self] text in
+        KeyBoardInputView.show(inputViewResultClosure: {
+            [weak self] (text) in
             self?.communityPostCommentApi(text: text, complete: {
-                self?.keyBoardCommentView?.dismisskeyBoardCommentView()
+                [weak self] in
+                self?.communityRecommendDataModel = nil
             })
-        })
-    }
-    /// 隐藏键盘
-    func hiddenKeyBoardCommentView() {
-        keyBoardCommentView?.hiddenViewClosure =  {
+        }) {
             [weak self] in
             self?.communityRecommendDataModel = nil
         }
@@ -455,7 +451,6 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
                 [weak self] in
                 self?.communityRecommendDataModel = self?.communityRecommendDataModels[indexPath.section]
                 self?.showKeyBoardCommentView()
-                self?.hiddenKeyBoardCommentView()
             }
             return cell
         default:

+ 4 - 11
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -24,7 +24,6 @@ class CommunityRecommendController: BaseViewController {
     var communityPostCommentsModel : CommunityPostCommentsModel?
     var communityPostCommentModels = Array<CommunityPostCommentModel>()
     var communityPostCommentModel : CommunityPostCommentModel?
-    var keyBoardCommentView : KeyBoardCommentView?
     // 相关推荐
     var communityPostDataModels = Array<CommunityPostDataModel>()
     // 全部评论
@@ -211,7 +210,6 @@ class CommunityRecommendController: BaseViewController {
             switch clickType {
             case BottomClickType.typeComment:
                 self?.showKeyBoardCommentView(placeholder: "添加评论...")
-                self?.hiddenKeyBoardCommentView()
             case BottomClickType.typeLike:
                 VirusViewModel.shared.virueRecordAddApiPraise(communityPostDetailModel: self?.communityPostDetailModel,commentView: (self?.commentView)!)
             case BottomClickType.typeCollect:
@@ -268,16 +266,13 @@ class CommunityRecommendController: BaseViewController {
     
     /// 显示键盘
     func showKeyBoardCommentView(placeholder:String) {
-        keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(placeholder:placeholder,sendClosure: {
+        KeyBoardInputView.show(placeholder: placeholder, inputViewResultClosure: {
             [weak self] text in
             self?.communityPostCommentApi(text: text, complete: {
-                self?.keyBoardCommentView?.dismisskeyBoardCommentView()
+                [weak self] in
+                self?.communityPostCommentModel = nil
             })
-        })
-    }
-    /// 隐藏键盘
-    func hiddenKeyBoardCommentView() {
-        keyBoardCommentView?.hiddenViewClosure =  {
+        }) {
             [weak self] in
             self?.communityPostCommentModel = nil
         }
@@ -599,7 +594,6 @@ extension CommunityRecommendController: UITableViewDataSource, UITableViewDelega
                 cell.commentClosure = {
                     [weak self] in
                     self?.showKeyBoardCommentView(placeholder: "添加评论...")
-                    self?.hiddenKeyBoardCommentView()
                 }
                 cell.userClosure = {
                     [weak self] in
@@ -652,7 +646,6 @@ extension CommunityRecommendController: UITableViewDataSource, UITableViewDelega
                     [weak self] in
                     self?.communityPostCommentModel = self?.communityPostCommentModels[indexPath.row]
                     self?.showKeyBoardCommentView(placeholder: "回复:@\(self?.communityPostCommentModel?.username ?? "")")
-                    self?.hiddenKeyBoardCommentView()
                 }
                 break
             }

+ 7 - 10
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/ViewController/CommunitySubCommentController.swift

@@ -17,7 +17,6 @@ class CommunitySubCommentController: BaseViewController {
     var communityPostReplysModel : CommunityPostReplysModel?
     var communityPostReplyModels = Array<CommunityPostReplyModel>()
     var communityPostReplyModel : CommunityPostReplyModel?
-    var keyBoardCommentView:KeyBoardCommentView?
 
     
     override func viewDidLoad() {
@@ -85,18 +84,17 @@ class CommunitySubCommentController: BaseViewController {
     
     /// 显示键盘
     func showKeyBoardCommentView(placeholder:String) {
-        keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(placeholder: placeholder,sendClosure: {
-             [weak self] text in
+        KeyBoardInputView.show(placeholder: placeholder, inputViewResultClosure: {
+            [weak self] text in
             self?.communityPostCommentApi(text: text, complete: {
-                self?.keyBoardCommentView?.dismisskeyBoardCommentView()
+                [weak self] in
+                self?.communityPostReplyModel = nil
             })
-        })
-    }
-    /// 隐藏键盘
-    func hiddenKeyBoardCommentView() {
-        keyBoardCommentView?.hiddenViewClosure =  {
+            
+        }) {
             [weak self] in
             self?.communityPostReplyModel = nil
+
         }
     }
 }
@@ -213,7 +211,6 @@ extension CommunitySubCommentController: UITableViewDataSource, UITableViewDeleg
                 [weak self] in
                 self?.communityPostReplyModel = self?.communityPostReplyModels[indexPath.row]
                 self?.showKeyBoardCommentView(placeholder: "回复:@\(self?.communityPostReplyModel?.username ?? "")")
-                self?.hiddenKeyBoardCommentView()
             }
             break
         }

+ 6 - 10
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityAllCommentView.swift

@@ -31,7 +31,6 @@ class CommunityAllCommentView: FWPopupView {
     var communityPostCommentsModel : CommunityPostCommentsModel?
     var communityPostCommentModels = Array<CommunityPostCommentModel>()
     var communityPostCommentModel : CommunityPostCommentModel?
-    var keyBoardCommentView : KeyBoardCommentView?
     
     override init(frame: CGRect) {
         super.init(frame: frame)
@@ -100,7 +99,6 @@ class CommunityAllCommentView: FWPopupView {
         commentInputView.commentInputViewClosure = {
             [weak self]  in
             self?.showKeyBoardCommentView(placeholder:"添加评论...")
-            self?.hiddenKeyBoardCommentView()
         }
     }
     
@@ -155,18 +153,17 @@ class CommunityAllCommentView: FWPopupView {
     
     /// 显示键盘
     func showKeyBoardCommentView(placeholder:String) {
-        keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(showView:self,placeholder:placeholder,sendClosure: {
+        
+        KeyBoardInputView.show(placeholder: placeholder, inputViewResultClosure: {
             [weak self] text in
             self?.communityPostCommentApi(text: text, complete: {
-                self?.keyBoardCommentView?.removeFromSuperview()
+                [weak self] in
+                self?.communityPostCommentModel = nil
             })
-        })
-    }
-    /// 隐藏键盘
-    func hiddenKeyBoardCommentView() {
-        keyBoardCommentView?.hiddenViewClosure =  {
+        }) {
             [weak self] in
             self?.communityPostCommentModel = nil
+
         }
     }
     
@@ -196,7 +193,6 @@ extension CommunityAllCommentView : UITableViewDelegate, UITableViewDataSource {
         if !communityPostCommentModels.isEmpty {
             communityPostCommentModel = self.communityPostCommentModels[indexPath.row]
             showKeyBoardCommentView(placeholder:"回复:@\(self.communityPostCommentModel?.username ?? "")")
-            hiddenKeyBoardCommentView()
         }
         
     }

+ 6 - 11
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoSubCommentController/CommunityVideoSubCommentController.swift

@@ -17,7 +17,6 @@ class CommunityVideoSubCommentController: BaseViewController {
     var communityPostReplysModel : CommunityPostReplysModel?
     var communityPostReplyModels = Array<CommunityPostReplyModel>()
     var communityPostReplyModel : CommunityPostReplyModel?
-    var keyBoardCommentView:KeyBoardCommentView?
 
     
     
@@ -76,23 +75,20 @@ class CommunityVideoSubCommentController: BaseViewController {
         }
         commentInputView.commentInputViewClosure = {
             [weak self]  in
-            self?.showKeyBoardCommentView(placeholder: "添加评论")
-            self?.hiddenKeyBoardCommentView()
+            self?.showKeyBoardCommentView(placeholder: "添加评论...")
         }
     }
     
     /// 显示键盘
     func showKeyBoardCommentView(placeholder:String) {
-        keyBoardCommentView = KeyBoardCommentView.keyBoardCommentView(placeholder: placeholder,sendClosure: {
+        
+        KeyBoardInputView.show(placeholder: placeholder, inputViewResultClosure: {
             [weak self] text in
             self?.communityPostCommentApi(text: text, complete: {
-                self?.keyBoardCommentView?.dismisskeyBoardCommentView()
+                [weak self] in
+                self?.communityPostReplyModel = nil
             })
-        })
-    }
-    /// 隐藏键盘
-    func hiddenKeyBoardCommentView() {
-        keyBoardCommentView?.hiddenViewClosure =  {
+        }) {
             [weak self] in
             self?.communityPostReplyModel = nil
         }
@@ -212,7 +208,6 @@ extension CommunityVideoSubCommentController: UITableViewDataSource, UITableView
             AlertSheetView.sheetCommentReplyView(userName: communityPostReplyModel?.username ?? "", content: communityPostReplyModel?.content ?? "") {
                 [weak self] in
                 self?.showKeyBoardCommentView(placeholder: "回复:@\(self?.communityPostReplyModel?.username ?? "")")
-                self?.hiddenKeyBoardCommentView()
             }
             break
         }

+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/comments_pic_bg.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "comments_pic_bg@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "comments_pic_bg@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

二进制
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/comments_pic_bg.imageset/comments_pic_bg@2x.png


二进制
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/comments_pic_bg.imageset/comments_pic_bg@3x.png


+ 0 - 193
RainbowPlanet/RainbowPlanet/Tools/KeyBoardCommentView/KeyBoardCommentView.swift

@@ -1,193 +0,0 @@
-//
-//  KeyBoardCommentView.swift
-//  RainbowPlanet
-//
-//  Created by 南鑫林 on 2019/7/11.
-//  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
-
-import UIKit
-import IQKeyboardManagerSwift
-import RxSwift
-import FWPopupView
-
-class KeyBoardCommentView: FWPopupView {
-    
-    let disposeBag = DisposeBag()
-    /// 上下间距
-    let topOrBottomEdge : CGFloat = 10
-    /// 输入框宽度
-    let inputTextViewWidth = kScreenWidth - 14 - 84
-    /// 键盘的高度
-    var keyboardH : CGFloat = 0
-    /// 动画时长
-    var duration : Double = 0
-    
-    /// 显示的View
-    var showView : UIView?
-    
-    override init(frame: CGRect) {
-        super.init(frame: frame)
-        setupViews()
-        setupData()
-        
-        configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
-    }
-    
-    required init?(coder aDecoder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-    
-    func setupViews() {
-        backgroundColor = UIColor.white
-        addSubview(inputTextView)
-        addSubview(sendButton)
-    }
-    
-    lazy var inputTextView: IQTextView = {
-        let inputTextView = IQTextView(frame: CGRect(x: 14, y: topOrBottomEdge, width: inputTextViewWidth, height: 28))
-        inputTextView.backgroundColor = kf0f0f0Color
-        inputTextView.font = kRegularFont14
-        inputTextView.layoutManager.allowsNonContiguousLayout = false
-        inputTextView.enablesReturnKeyAutomatically = true
-        inputTextView.scrollsToTop = false
-        inputTextView.textContainerInset = UIEdgeInsets(top: 5, left: 15, bottom: 5, right: 10)
-        inputTextView.textContainer.lineFragmentPadding = 0
-        inputTextView.layer.cornerRadius = 14
-        inputTextView.layer.masksToBounds = true
-        inputTextView.delegate = self
-        inputTextView.tintColor = kThemeColor
-        return inputTextView
-    }()
-    
-    lazy var sendButton: UIButton = {
-        let sendButton = UIButton(type: UIButton.ButtonType.custom)
-        sendButton.frame = CGRect(x: kScreenWidth - 14 - 60, y: 11, width: 60, height: 28)
-        sendButton.setTitle("发送", for: UIControl.State.normal)
-        sendButton.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for: UIControl.State.normal)
-        sendButton.setBackgroundImage(UIImage.imageWithColor(color: kd8d8d8Color), for: UIControl.State.disabled)
-        sendButton.titleLabel?.font = kRegularFont14
-        sendButton.layer.cornerRadius = 14;
-        sendButton.layer.masksToBounds = true
-        sendButton.isEnabled = true
-        return sendButton
-    }()
-    
-    func setupData() {
-        //监听键盘弹出通知
-        _ = NotificationCenter.default.rx
-            .notification(UIResponder.keyboardWillShowNotification)
-            .takeUntil(self.rx.deallocated) //页面销毁自动移除通知监听
-            .subscribe(onNext: { [weak self] notification in
-                let userInfo = notification.userInfo
-                // 动画的持续时间
-                self?.duration = (userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double)!
-                // 键盘的frame
-                let keyboardFrame = userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect
-                self?.keyboardH = (keyboardFrame?.size.height)!
-            })
-        
-        //监听键盘隐藏通知
-        _ = NotificationCenter.default.rx
-            .notification(UIResponder.keyboardWillHideNotification)
-            .takeUntil(self.rx.deallocated) //页面销毁自动移除通知监听
-            .subscribe(onNext: { [weak self] notification in
-                let userInfo = notification.userInfo
-                // 动画的持续时间
-                self?.duration = (userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double)!
-                // 键盘的frame
-                let keyboardFrame = userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect
-                self?.keyboardH = (keyboardFrame?.size.height)!
-                self?.dismisskeyBoardCommentView()
-            })
-        
-        //发送
-        sendButton.rx.tap.subscribe(onNext: {
-            [weak self] _ in
-            self?.sendClosure?(self?.inputTextView.text ?? "")
-        }).disposed(by: disposeBag)
-    }
-    
-    
-    /// 发送完成回调
-    typealias SendClosure = (String) -> ()?
-    var sendClosure :SendClosure?
-    
-    
-    /// 隐藏View回调
-    typealias HiddenViewClosure = () -> ()
-    var hiddenViewClosure :HiddenViewClosure?
-    
-    
-    /// 显示View
-    func showkeyBoardCommentView() {
-        self.inputTextView.becomeFirstResponder()
-    }
-    
-    /// 隐藏View
-    func dismisskeyBoardCommentView() {
-        self.hide {
-            [weak self] _ in
-            if let hiddenViewClosure = self?.hiddenViewClosure {
-                hiddenViewClosure()
-            }
-        }
-    }
-    
-    /// 初始化
-    class func keyBoardCommentView(showView:UIView? = nil, placeholder:String = "添加评论...",sendClosure :SendClosure? = nil) -> KeyBoardCommentView {
-        let view = KeyBoardCommentView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 48))
-        view.showkeyBoardCommentView()
-        if showView != nil{
-            view.attachedView = showView
-            view.showView = showView
-        }
-        view.withKeyboard = true
-        view.inputTextView.placeholder = placeholder
-        if sendClosure != nil {
-            view.sendClosure = sendClosure
-        }
-        let vProperty = FWPopupViewProperty()
-        vProperty.animationDuration = view.duration
-        vProperty.popupCustomAlignment = .bottomCenter
-        view.frame = CGRect(x: 0, y: kScaleHeight - view.keyboardH , width: kScreenWidth, height: 48)
-        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        vProperty.popupAnimationType = .frame
-        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
-        vProperty.touchWildToHide = "1"
-        view.vProperty = vProperty
-        view.show()
-        view.superview?.bringSubviewToFront(view)
-        return view
-    }
-
-}
-
-extension KeyBoardCommentView : UITextViewDelegate {
-    
-    /// 改变textView的高度
-    func textViewDidChange(_ textView: UITextView) {
-        TextLimitTool.restrictionInputTextView(inputTextView, maxNumber: 150)
-        if  inputTextView.text.count > 0 {
-            sendButton.isEnabled = true
-        }else {
-            sendButton.isEnabled = false
-        }
-        let contentSizeH = self.inputTextView.contentSize.height
-        if (contentSizeH > 28) {
-            textView.height = contentSizeH
-        }else {
-            textView.height = 28
-        }
-        self.height = textView.height + 20
-        if showView != nil {
-            self.y = (attachedView?.height ?? 0) - keyboardH - self.height
-        }else {
-            self.y = kScreenHeight -  self.height
-        }
-        sendButton.y = textView.height + 20 - 38
-        self.frame = CGRect(x: 0, y: self.y , width: kScreenWidth, height: self.height)
-
-    }
-}
-

+ 106 - 197
RainbowPlanet/RainbowPlanet/Tools/KeyBoardCommentView/KeyBoardInputView.swift

@@ -7,253 +7,162 @@
 //
 
 import Foundation
-import IQKeyboardManagerSwift
+import InputBarAccessoryView
 
 typealias InputViewResultClosure = (_ contentStr: String) -> Void
 
-typealias DismissClosure = () -> Void
+typealias InputViewDismissClosure = () -> Void
 
 typealias InputAccessoryConfigeClosure = (_ inputConfiger: InputConfiger) -> Void
 
-class KeyBoardInputView: NSObject {
-    
-    deinit {
-        NXLLog("deinit")
-    }
+class KeyBoardInputView: InputBarAccessoryView {
     
     private var inputViewResultClosure : InputViewResultClosure!
-    private var dismissClosure : DismissClosure!
+    private var inputViewDismissClosure : InputViewDismissClosure!
     
-    private var inputView : IQTextView!
-    private var btnSave : UIButton!
-    private var toolbar : UIView!
     
-    private var assistDismissButton : UIButton!
-    private var assistInputView : UITextField!
+    private lazy var assistDismissButton: UIButton = {
+        let assistDismissButton = UIButton(type: UIButton.ButtonType.custom)
+        assistDismissButton.backgroundColor = UIColor(white: 0, alpha: 0.5)
+        assistDismissButton.addTarget(self, action: #selector(dismiss), for: UIControl.Event.touchUpInside)
+        return assistDismissButton
+    }()
     
-    static let shared : KeyBoardInputView = KeyBoardInputView()
-    
-    class func dimiss() {
-        KeyBoardInputView.shared.dismiss()
-    }
+    private lazy var keyboardManager: KeyboardManager = {
+        let keyboardManager = KeyboardManager()
+        return keyboardManager
+    }()
     
-    class func show(inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure) {
-        KeyBoardInputView.shared.initInputView(inputConfiger: InputConfiger(), inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
-    }
+    private var keyBoardInputView : KeyBoardInputView?
     
-    class func show(KeyboardType:UIKeyboardType,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure)  {
-        let inputConfiger = InputConfiger()
-        inputConfiger.keyboardType = KeyboardType
-        KeyBoardInputView.shared.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
-
+    class func show(inputViewResultClosure:@escaping InputViewResultClosure,inputViewDismissClosure:@escaping InputViewDismissClosure) {
+        KeyBoardInputView.initInputView(inputConfiger: InputConfiger(), inputViewResultClosure: inputViewResultClosure, inputViewDismissClosure: inputViewDismissClosure)
     }
     
-    class func show(KeyboardType:UIKeyboardType,content:String,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure)  {
+    class func show(placeholder:String,inputViewResultClosure:@escaping InputViewResultClosure,inputViewDismissClosure:@escaping InputViewDismissClosure)  {
         let inputConfiger = InputConfiger()
-        inputConfiger.keyboardType = KeyboardType
-        inputConfiger.content = content
-        KeyBoardInputView.shared.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
+        inputConfiger.placeholder = placeholder
+        KeyBoardInputView.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, inputViewDismissClosure: inputViewDismissClosure)
     }
     
-    class func show(inputAccessoryConfigeClosure:@escaping InputAccessoryConfigeClosure,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure) {
+    class func show(inputAccessoryConfigeClosure:@escaping InputAccessoryConfigeClosure,inputViewResultClosure:@escaping InputViewResultClosure,inputViewDismissClosure:@escaping InputViewDismissClosure) {
 
         let inputConfiger = InputConfiger()
         inputAccessoryConfigeClosure(inputConfiger)
-        KeyBoardInputView.shared.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
+        KeyBoardInputView.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, inputViewDismissClosure: inputViewDismissClosure)
     }
     
-    private func initInputView(inputConfiger:InputConfiger,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure) {
+    private class func initInputView(inputConfiger:InputConfiger,inputViewResultClosure:@escaping InputViewResultClosure,inputViewDismissClosure:@escaping InputViewDismissClosure) {
+        let keyBoardInputView = KeyBoardInputView()
+        keyBoardInputView.assistDismissButton.backgroundColor = inputConfiger.backgroundColor
+        keyBoardInputView.inputTextView.placeholder = inputConfiger.placeholder
+        keyBoardInputView.keyBoardInputView = keyBoardInputView
+        keyBoardInputView.inputViewResultClosure = inputViewResultClosure
+        keyBoardInputView.inputViewDismissClosure = inputViewDismissClosure
+        
+    }
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
         initView()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    private func initView() {
         let window = kAppDelegate.window
-        self.assistDismissButton.frame = window!.bounds
-        self.assistDismissButton.autoresizingMask = UIView.AutoresizingMask(rawValue: UIView.AutoresizingMask.flexibleWidth.rawValue | UIView.AutoresizingMask.flexibleHeight.rawValue)
-        window?.addSubview(assistDismissButton)
-        
-        self.updateLayout(beigin: true)
-        
-        self.inputViewResultClosure = inputViewResultClosure
-        self.dismissClosure = dismissClosure
-        self.inputView.text = inputConfiger.content
-        self.assistInputView.text = inputConfiger.content
-        
-        self.inputView.keyboardType = inputConfiger.keyboardType;
-        self.inputView.placeholder = inputConfiger.placeholder
-        self.assistInputView.keyboardType = inputConfiger.keyboardType;
-        self.btnSave.isEnabled = false
-        self.assistDismissButton.isUserInteractionEnabled = inputConfiger.backgroundUserInterface
-        self.assistDismissButton.backgroundColor = inputConfiger.backgroundColor
+        self.backgroundColor = UIColor.clear
+        self.backgroundView.backgroundColor = UIColor.clear
         
-        self.assistInputView.inputAccessoryView = toolbar
-        self.assistInputView.becomeFirstResponder()
-        
-        NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: nil) {[weak self] (notification) in
-            if ((self?.assistDismissButton?.window) != nil) && (self?.assistInputView.isFirstResponder)! {
-                self?.inputView.becomeFirstResponder()
-                self?.inputView.scrollRangeToVisible(NSRange(location: (self?.inputView.text.count)!, length: 1))
-            }
-        }
+        assistDismissButton.frame = window!.bounds
+        assistDismissButton.autoresizingMask = UIView.AutoresizingMask(rawValue: UIView.AutoresizingMask.flexibleWidth.rawValue | UIView.AutoresizingMask.flexibleHeight.rawValue)
+        window?.addSubview(assistDismissButton)
         
-        //输入切换
-        NotificationCenter.default.addObserver(forName: UITextInputMode.currentInputModeDidChangeNotification, object: nil, queue: nil) {
-            [weak self] (notification) in
-            self?.assistInputView.resignFirstResponder()
-            self?.assistInputView.becomeFirstResponder()
+        frame = CGRect(x: 0, y: kScreenHeight, width: kScreenWidth, height: 48)
+        let imageView = UIImageView(frame: frame)
+        let image = UIImage(named: "comments_pic_bg")?
+            .resizableImage(withCapInsets: UIEdgeInsets(top: 10, left: 10, bottom: 0, right: 10),
+                            resizingMode: .stretch) //左右15像素的部分不变,中间部分来拉伸
+        imageView.image = image
+        assistDismissButton.addSubview(imageView)
+        assistDismissButton.addSubview(self)
+
+        imageView.snp.makeConstraints { (make) in
+            make.edges.equalTo(self)
         }
         
-        NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillHideNotification, object: nil, queue: nil) { [weak self] (notification) in
-            if (self?.inputView.isFirstResponder)! {
-                self?.dismiss()
+        delegate = self
+        
+        inputTextView.tintColor = kThemeColor
+        inputTextView.backgroundColor = kfafafaColor
+        inputTextView.cornerRadius = 14
+        inputTextView.masksToBounds = true
+        inputTextView.layer.borderColor = kf0f0f0Color.cgColor
+        inputTextView.layer.borderWidth = 0.5
+        inputTextView.placeholderTextColor = k999999Color
+        inputTextView.textContainerInset = UIEdgeInsets(top: 5, left: 10, bottom: 5, right: 10)
+        inputTextView.placeholderLabelInsets = UIEdgeInsets(top: 5, left: 15, bottom: 5, right: 15)
+        
+        sendButton.setBackgroundImage(UIImage.imageWithColor(color: kd8d8d8Color), for: UIControl.State.disabled)
+        sendButton.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for: UIControl.State.normal)
+        sendButton.titleLabel?.font = kRegularFont14
+        sendButton.setTitleColor(UIColor.white, for: UIControl.State.normal)
+        sendButton.setTitleColor(UIColor.white, for: UIControl.State.disabled)
+        sendButton.setSize(CGSize(width: 60, height: 28), animated: false)
+        sendButton.title = "发布"
+        sendButton.cornerRadius = 14
+        sendButton.masksToBounds = true
+
+        padding = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
+        middleContentViewPadding = UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 10)
+        separatorLine.isHidden = true
+        setMiddleContentView(inputTextView, animated: false)
+        
+        keyboardManager.bind(inputAccessoryView: self)
+        keyboardManager.on(event: KeyboardEvent.willHide) {
+            [weak self] (KeyboardNotification) in
+            if !(self?.sendButton.isEnabled ?? false) {
+                self?.cleanView()
             }
         }
         
-        NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidHideNotification, object: nil, queue: nil) { [weak self] (notification) in
-            self?.cleanInitView()
-        }
-        
-    }
-    
-    private func initView() {
-        
-        /// 背景button
-        let backgroundBtn = UIButton(type: UIButton.ButtonType.custom)
-        backgroundBtn.addTarget(self, action: #selector(dismiss), for: UIControl.Event.touchUpInside)
-
-        /// 工具bar
-        let toolbar = UIView()
-        toolbar.backgroundColor = UIColor.white
-        
-        
-        /// 输入框
-        let textView = IQTextView()
-        textView.returnKeyType = .done
-        textView.enablesReturnKeyAutomatically = true
-        textView.delegate = self
-        textView.font = kRegularFont14
-        textView.layer.borderColor = kf0f0f0Color.cgColor
-        textView.layer.borderWidth = 0.5/UIScreen.main.scale
-        textView.textContainerInset = UIEdgeInsets(top: 5.5, left: 15, bottom: 5.5, right: 15)
-//        textView.textContainer.lineFragmentPadding = 0
-        textView.cornerRadius = 14
-        textView.masksToBounds = true
-        textView.tintColor = kThemeColor
-        textView.backgroundColor = kfafafaColor
-        toolbar.addSubview(textView)
-        
-        let assistTxf = UITextField()
-        assistTxf.returnKeyType = .done
-        assistTxf.enablesReturnKeyAutomatically = true
-        backgroundBtn.addSubview(assistTxf)
-        
-        /// 确定
-        let saveBtn = UIButton(type: UIButton.ButtonType.custom)
-        saveBtn.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for: UIControl.State.normal)
-        saveBtn.setBackgroundImage(UIImage.imageWithColor(color: kd8d8d8Color), for: UIControl.State.disabled)
-        saveBtn.titleLabel?.font = kRegularFont14
-        saveBtn.setTitle("发布", for: UIControl.State.normal)
-        saveBtn.cornerRadius = 14
-        saveBtn.masksToBounds = true
-        saveBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
-        saveBtn.addTarget(self, action: #selector(save), for: UIControl.Event.touchUpInside)
-        toolbar.addSubview(saveBtn)
-        
-        self.toolbar = toolbar
-        self.assistDismissButton = backgroundBtn
-        self.inputView = textView
-        self.assistInputView = assistTxf
-        self.btnSave = saveBtn
-        
-    }
-    
-    func updateLayout(beigin:Bool) {
-        let saveButtonWidth : CGFloat = 60
-        let edge : CGFloat = 10.0
-        
-        var height = max(48, inputView.contentSize.height + 17.5)
-        height = min(height, 100)
-        UIView.animate(withDuration: beigin ? 0 : 0.2) {
-            [weak self] in
-            self?.toolbar.frame = CGRect(x: 0, y: 48-height, width: kScreenWidth, height: height)
-            self?.toolbar.configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
-            self?.inputView.frame = CGRect(x: 14, y: edge, width: kScreenWidth - saveButtonWidth - 38.0, height: height - edge * 2)
-            self?.btnSave.frame = CGRect(x: kScreenWidth - saveButtonWidth - 14, y: height - 10 - 28 , width: saveButtonWidth, height: 28.0)
-            self?.assistInputView.inputAccessoryView = self?.toolbar
-        }
+        inputTextView.becomeFirstResponder()
     }
     
     @objc func dismiss() {
-        self.inputView.resignFirstResponder()
-        self.assistDismissButton.removeFromSuperview()
-        NotificationCenter.default.removeObserver(self)
-    }
-    
-    @objc func save() {
-        self.inputView.resignFirstResponder()
-        if self.btnSave.isEnabled {
-            if let inputViewResultClosure = self.inputViewResultClosure {
-                inputViewResultClosure(self.inputView.text ?? "")
-            }
+        if let dismissClosure = self.inputViewDismissClosure {
+            dismissClosure()
         }
-        self.dismiss()
+        cleanView()
     }
     
-    func cleanInitView() {
-        
-        if let dismissClosure = self.dismissClosure {
-            dismissClosure()
-        }
-        if self.toolbar != nil {
-            self.toolbar.removeFromSuperview()
-        }
-        if self.assistDismissButton != nil {
-            self.assistDismissButton.removeFromSuperview()
-        }
-        if self.inputView != nil {
-            self.inputView.removeFromSuperview()
-        }
-        if self.assistInputView != nil {
-            self.assistInputView.removeFromSuperview()
-        }
-        if self.btnSave != nil {
-            self.btnSave.removeFromSuperview()
-        }
-        self.toolbar = nil
-        self.assistDismissButton = nil
-        self.inputView = nil
-        self.assistInputView = nil
-        self.btnSave = nil
-        self.inputViewResultClosure = nil
+    private func cleanView() {
+        inputTextView.resignFirstResponder()
+        assistDismissButton.removeFromSuperview()
+        keyBoardInputView = nil
     }
     
 }
 
-extension KeyBoardInputView : UITextViewDelegate {
-    func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
-        if text == "\n" {
-            self.save()
-            return false
+extension KeyBoardInputView : InputBarAccessoryViewDelegate {
+    
+    func inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {
+        if let inputViewResultClosure = inputViewResultClosure {
+            inputViewResultClosure(text)
         }
-        return true
+        cleanView()
     }
     
-    func textViewDidChange(_ textView: UITextView) {
-        TextLimitTool.restrictionInputTextView(textView, maxNumber: 150)
-        self.updateLayout(beigin: false)
-        if textView.text.count > 0 {
-            self.btnSave.isEnabled = true
-        }else {
-            self.btnSave.isEnabled = false
-        }
+    func inputBar(_ inputBar: InputBarAccessoryView, textViewTextDidChangeTo text: String) {
+        TextLimitTool.restrictionInputTextView(inputTextView, maxNumber: 150)
     }
+    
 }
 
 class InputConfiger: NSObject {
     
-    // default UIKeyboardTypeDefault
-    var keyboardType : UIKeyboardType = UIKeyboardType.default
-    // default nil
-    var content : String = ""
-    // default YES
-    var backgroundUserInterface : Bool = true
     // default clearColor
     var backgroundColor : UIColor = UIColor(white: 0, alpha: 0.5)
     // default placeholder