From f6de024d296f2cbda8e97a3cd565a6b37866ec3c Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Fri, 1 Sep 2017 04:53:39 -0500 Subject: [PATCH] Set defaults for InputTextView --- .../Sources/ConversationViewController.swift | 8 +++---- MessageKit.xcodeproj/project.pbxproj | 4 ---- Sources/InputTextView.swift | 6 +++-- Sources/KeyboardTracker.swift | 23 ------------------- Sources/MessageInputBar.swift | 2 +- 5 files changed, 9 insertions(+), 34 deletions(-) delete mode 100644 Sources/KeyboardTracker.swift diff --git a/Example/Sources/ConversationViewController.swift b/Example/Sources/ConversationViewController.swift index 2594a435..60fb3dba 100644 --- a/Example/Sources/ConversationViewController.swift +++ b/Example/Sources/ConversationViewController.swift @@ -40,7 +40,7 @@ class ConversationViewController: MessagesViewController { messagesCollectionView.messageLabelDelegate = self messageInputBar.delegate = self - setupInputBar() + //setupInputBar() } func setupInputBar() { @@ -75,9 +75,9 @@ class ConversationViewController: MessagesViewController { } ] - // We can change the container insets if we want -// messageInputBar.inputTextView.textContainerInset = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0) -// messageInputBar.inputTextView.placeholderLabelInsets = UIEdgeInsets(top: 8, left: 5, bottom: 8, right: 5) + //We can change the container insets if we want + messageInputBar.inputTextView.textContainerInset = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0) + messageInputBar.inputTextView.placeholderLabelInsets = UIEdgeInsets(top: 8, left: 5, bottom: 8, right: 5) // Adjust the padding messageInputBar.padding.top = 8 diff --git a/MessageKit.xcodeproj/project.pbxproj b/MessageKit.xcodeproj/project.pbxproj index 7d2c29ae..a6cae3fe 100644 --- a/MessageKit.xcodeproj/project.pbxproj +++ b/MessageKit.xcodeproj/project.pbxproj @@ -42,7 +42,6 @@ B09643861F286C9E004D0129 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B09643851F286C9E004D0129 /* String+Extensions.swift */; }; B096438E1F2890FB004D0129 /* MessagesDisplayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B096438D1F2890FB004D0129 /* MessagesDisplayDataSource.swift */; }; B09643901F289142004D0129 /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B096438F1F289142004D0129 /* UIColor+Extensions.swift */; }; - B0A9B66F1F555FEA004273F1 /* KeyboardTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0A9B66E1F555FEA004273F1 /* KeyboardTracker.swift */; }; B0AA1F511F42E91A00BAE583 /* AvatarPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0AA1F501F42E91A00BAE583 /* AvatarPosition.swift */; }; B0AA1F531F44388C00BAE583 /* NSAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0AA1F521F44388900BAE583 /* NSAttributedString+Extensions.swift */; }; /* End PBXBuildFile section */ @@ -96,7 +95,6 @@ B09643851F286C9E004D0129 /* String+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = ""; }; B096438D1F2890FB004D0129 /* MessagesDisplayDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessagesDisplayDataSource.swift; sourceTree = ""; }; B096438F1F289142004D0129 /* UIColor+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Extensions.swift"; sourceTree = ""; }; - B0A9B66E1F555FEA004273F1 /* KeyboardTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardTracker.swift; sourceTree = ""; }; B0AA1F501F42E91A00BAE583 /* AvatarPosition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvatarPosition.swift; sourceTree = ""; }; B0AA1F521F44388900BAE583 /* NSAttributedString+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+Extensions.swift"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -194,7 +192,6 @@ B0655A271F23D71400542A83 /* MessageDirection.swift */, B0AA1F501F42E91A00BAE583 /* AvatarPosition.swift */, B05530B41F493CFA008BB420 /* DetectorType.swift */, - B0A9B66E1F555FEA004273F1 /* KeyboardTracker.swift */, ); name = Models; sourceTree = ""; @@ -409,7 +406,6 @@ B05530B51F493CFA008BB420 /* DetectorType.swift in Sources */, 88916B471CF0DFE600469F91 /* MessageType.swift in Sources */, B0AA1F511F42E91A00BAE583 /* AvatarPosition.swift in Sources */, - B0A9B66F1F555FEA004273F1 /* KeyboardTracker.swift in Sources */, B03FF9AF1F31BB1200754FE5 /* MessageCellDelegate.swift in Sources */, 37C936981F38F6AC00853DF2 /* Avatar.swift in Sources */, B096438E1F2890FB004D0129 /* MessagesDisplayDataSource.swift in Sources */, diff --git a/Sources/InputTextView.swift b/Sources/InputTextView.swift index db3ef099..e5a790b4 100644 --- a/Sources/InputTextView.swift +++ b/Sources/InputTextView.swift @@ -64,7 +64,7 @@ open class InputTextView: UITextView { } } - open var placeholderLabelInsets: UIEdgeInsets = UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 4) { + open var placeholderLabelInsets: UIEdgeInsets = UIEdgeInsets(top: 4, left: 7, bottom: 4, right: 4) { didSet { updateConstraintsForPlaceholderLabel() } @@ -92,7 +92,9 @@ open class InputTextView: UITextView { font = UIFont.preferredFont(forTextStyle: .body) textContainerInset = UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 4) isScrollEnabled = false - backgroundColor = .purple + layer.cornerRadius = 5.0 + layer.borderWidth = 1.25 + layer.borderColor = UIColor.lightGray.cgColor addSubviews() addConstraints() diff --git a/Sources/KeyboardTracker.swift b/Sources/KeyboardTracker.swift deleted file mode 100644 index 9d48d220..00000000 --- a/Sources/KeyboardTracker.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// KeyboardTracker.swift -// MessageKit -// -// Created by Steven on 8/29/17. -// Copyright © 2017 MessageKit. All rights reserved. -// - -import Foundation - -final class KeyboardTracker { - - enum KeyboardState { - case shown - case hidden - case transitioning - } - - init() { - - } - -} diff --git a/Sources/MessageInputBar.swift b/Sources/MessageInputBar.swift index 58f25b7c..48ab394b 100644 --- a/Sources/MessageInputBar.swift +++ b/Sources/MessageInputBar.swift @@ -216,7 +216,7 @@ open class MessageInputBar: UIView { open func setup() { - backgroundColor = .white + backgroundColor = .inputBarGray autoresizingMask = [.flexibleHeight, .flexibleBottomMargin] setupSubviews() setupConstraints()