Swift 3: UITextView - Dynanmic height - Programmatically - ios

I have a keyboardContainer class (Subclass of UIView / created programmatically so no storyboard) including a UITextView for the user to type messages in. It is used within a Chat log class and set as the inputAccessoryView. I want to dynamically change the height of it when the user is typing.
I searched for answers and found some. However, I didn't get most of them as they didn't work for me.
What do I have to implement to get the effect I want to have?
Thank´s for your help!
EDIT:
First of all thank you for your help!
However, I´m pretty new to coding so I could not solve the issue. I guess it has something to do with the way I created my keyboardContainer class and its constraints...
Here is the relevant code from within my keyboard container class:
let textField:UITextView = {
let view = UITextView()
view.translatesAutoresizingMaskIntoConstraints = false
view.layer.cornerRadius = 15
view.layer.masksToBounds = true
view.font = UIFont.systemFont(ofSize: 15)
view.backgroundColor = .white
return view
}()
overried init(frame: CGRect){
super.init(frame: frame)
addSubview(textField)
textField.leftAnchor.constraint(equalTo: leftButton, constant: 5).isActive = true
textField.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
textFieldHeightAnchor = textField.heightAnchor.constraint(equalTo: heightAnchor, constant: -10)
textFieldHeightAnchor.isActive = true
textFieldRightAnchor = textField.rightAnchor.constraint(equalTo: rightAnchor, constant: -85)
textFieldRightAnchor.isActive = true
}
Inside my ChatLog I´m using this:
lazy var keyboard: KeyboardContainer = {
let key = KeyboardContainer()
key.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: 45)
key.sendButton.addTarget(self, action: #selector(handleSend), for: .touchUpInside)
return key
}()
override var inputAccessoryView: UIView?{
get{
return keyboard
}
}
What do I need to change ? I guess the constraints?

You can make your textView conform to the UITextViewDelegate and then resize it to it's contentSize.
Make your view controller conform to the delegate
class ViewController: UIViewController, **UITextViewDelegate** { ...
After that
yourTextView.delegate = self // put that in viewDidLoad()
Then you can implement the textViewDidChange method. That means, every time you enter something into the keyboard, this function is called.
func textViewDidChange(_ textView: UITextView) {
if textView == youTextView {
let currentHeight = textView.frame.size.height
textView.frame.size.height = 0 // you have to do that because if not it's not working with the proper content size
textView.frame.size = textView.contentSize // here you detext your textView's content size and make it resize.
let newHeight = textView.frame.size.height
let heightDifference = newHeight - currentHeight // get the height difference from before and after editing
yourContainerView.frame.size.height += heightDifference
}
}

Just disable the scrolling. Don't set any other constraints. This might help you with this.
In your viewDidLoad method,
YourTextView.translatesAutoresizingMaskIntoConstraints = true
YourTextView.sizeToFit()
YourTextView.isScrollEnabled = false
YourTextView.delegate = self
YourTextView.isEditable = true
Then use UITextViewDelegate and,
func textViewDidChange(_ textView: UITextView) {
MyTextView.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 100)
MyTextView.translatesAutoresizingMaskIntoConstraints = true
MyTextView.sizeToFit()
MyTextView.isScrollEnabled = false
}
This was before the change,
This was after,

If you are looking for UITextView like any message app.
No need to deal with code you can manage it using constraints only.
Seems a better way to do this using constraints rather than deal with more coding.
Here is the step by step explanation of this.
Step : 1
Arrange UItextView and UIBUtton inside one UIView and give height constraint to UIView with low priority.
Step : 2
Also give height constraint to UITextView with Greater Then or Equal. as image represent it.
Step : 3
Now you just have to deal with contentSize and isScrollEnabled as below snippet.
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool{
if (textView.contentSize.height < 150){
textView.isScrollEnabled = false
}
else{
textView.isScrollEnabled = true
}
return true
}
Hope this help you!!

Related

Hide colored border with subview

I have uiview with colored border. I want to add a subview above, so it "hide" parent view border. Currently when i try to add a view (subclass of UILabel) above it's not overlap anything as i want. What i want is remove white line when it interact with label frame.
My class is:
class LabeledContainerView: UIView {
var text: String!
var height: CGFloat!
var offset: CGFloat!
var label: UILabel = {
let lbl = LabelSL.create(textColor: Theme.Color.white,
font: Theme.Font.regular())
lbl.text = Strings.login.value
lbl.backgroundColor = Theme.Color.clear.value
return lbl
}()
init(text: String,
height: Double,
offset: Double) {
super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
self.text = text
self.height = CGFloat(height)
self.offset = CGFloat(offset)
createUI()
setConstraints()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
func highlight(){
}
func turnOffHighlight(){
}
private func createUI(){
translatesAutoresizingMaskIntoConstraints = false
clipsToBounds = false
layer.cornerRadius = 4.0
layer.borderColor = UIColor.white.cgColor
layer.borderWidth = 2.0
addSubview(label)
}
private func setConstraints(){
let tinyOffset: CGFloat = 2
label.leftAnchor.constraint(equalTo: leftAnchor, constant: offset + tinyOffset).isActive = true
label.centerYAnchor.constraint(equalTo: topAnchor).isActive = true
}
}
You can do that without adding another view above it.
By set your textfield delegate to self then
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if textField.text?.isEmpty ?? false{
//yourView.hideBorders
}
}
If i didn't got your point please clarify
You have set lbl.backgroundColor = Theme.Color.clear.value.
Thats why you can see the border. Set background color of label same as your view background color.
You need to ensure two things are happening:
The UILabel is in front of the UITextField in the view hierarchy
This can be set either in the XIB file (storyboard) or programatically:
In the XIB depending on the where the view is in the list determines its priority. The higher it is in the list the further back it is. Therefore you want to move your label to be below your UITextField. You can drag and drop it in the left hand list.
You can also set this programatically by pushing your textField to the back of the hierarchy:
sendSubviewToBack(UITextField)
The UILabel has a background colour
This can also be set programatically or in the XIB:
Programatically:
label.backgroundColor = .red
XIB:
Checking these two things will ensure that the UILabel is in front of the UITextField and covers the border when it has text.

textViewDidChange is only changing when a full string is typed. I want it to check every character

I have a UITextView that dynamically changes in height when text is typed beyond it's frame's bounds. However, the height will only change once the full string is typed and you press space. This leaves an awkward moment where the user can't see the word they're typing.
How can I have my textViewDidChange react for every character typed rather than when a full string is entered?
This is the initialized variable:
lazy var descriptionTextView: UITextView = {
let tv = UITextView()
tv.backgroundColor = .white
tv.font = UIFont.systemFont(ofSize: 18)
tv.frame = CGRect(x: 0, y: 0, width: 200, height: 40)
tv.translatesAutoresizingMaskIntoConstraints = false
tv.delegate = self
tv.isScrollEnabled = false
return tv
}()
Then I add it to the subview and anchor it in my viewDidLoad:
view.addSubview(descriptionTextView)
descriptionTextView.anchor(top: privacyLabel.bottomAnchor, left:
view.leftAnchor, bottom: descriptionTextViewUnderLine.topAnchor, right: view.rightAnchor, paddingTop: 16, paddingLeft: 24, paddingBottom: 0, paddingRight: 24, width: 0, height: 40)
In an extension, I put textViewDidChange
func textViewDidChange(_ textView: UITextView) {
let size = CGSize(width: view.frame.width, height: .infinity)
let estimatedSize = textView.sizeThatFits(size)
textView.constraints.forEach { (constraint) in
if constraint.firstAttribute == .height {
constraint.constant = estimatedSize.height
}
}
}
Thanks in advance for your help!
textViewDidChange(...) actually should react for every character entered (via keyboard, not programmatically). It's possible that textView.sizeThatFits(...) doesn't return what you want. A quick look at the documentation doesn't reveal an override to UIView's implementation, which just returns the same size of of the view.
NSAttributedString's boundingRect(with:options:context:) might be worth looking into to get back the desired size of the text (and thus of the view).
Also note my comment to your question. Setting scrollEnabled to false should already set the intrinsic size of the textView to the size that you need, and you shouldn't even have to set a height constraint. If your textView is getting squashed between views with constraints of equal priority, you can raise the compressionResistancePriority along the vertical axis.
A quick snippet to illustrate the example (not an answer to your question, but maybe a different approach to what you're trying to do):
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController, UITextViewDelegate {
private lazy var textView = UITextView()
override func loadView() {
let view = UIView()
view.backgroundColor = .orange
textView.frame = view.bounds
textView.backgroundColor = .white
textView.isScrollEnabled = false
textView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(textView)
NSLayoutConstraint.activate(
[textView.topAnchor.constraint(equalTo: view.topAnchor),
textView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
textView.leadingAnchor.constraint(equalTo: view.leadingAnchor)]
)
textView.delegate = self
self.view = view
}
func textViewDidChange(_ textView: UITextView) {
print(textView.text)
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()
I have implemented this using constraints in storyboard.
The storyboard is like below:
Code that I have added in Controller is :
class ViewController: UIViewController {
#IBOutlet weak var messageTextView: UITextView!
#IBOutlet weak var messageTextViewHeightConstraint: NSLayoutConstraint!
}
extension ViewController: UITextViewDelegate {
public func textViewDidChange(_ textView: UITextView) {
resizeTextView(textView: textView)
}
func resizeTextView(textView: UITextView) {
let sizeThatFitsTextView = messageTextView.sizeThatFits(CGSize(width: messageTextView.frame.width, height: CGFloat(MAXFLOAT)))
messageTextViewHeightConstraint.constant = sizeThatFitsTextView.height
}
}
I am changing the height of the UITextView dynamically using constraints here and it increases if you will add text beyond it's frame.
Hope this helps to achieve what you want.
You need to use UITextView frame instead of UIView.
func textViewDidChange(_ textView: UITextView) {
let size = CGSize(width: textView.frame.width, height: .infinity)
let estimatedSize = textView.sizeThatFits(size)
textView.constraints.forEach { (constraint) in
if constraint.firstAttribute == .height {
constraint.constant = estimatedSize.height
}
}
}

inputAccessoryView with intrinsicContentSize in iphone x not working

please do not down vote will try my best to explain problem.
i have an InputAccessoryView which was working fine before iphone x, in iphone x my inputAssesoryView is showing at very bottom below the layoutguide. i found following solution
inputAccessoryView Iphone X
after following idea from above link i can place my textfield above the layout guid but it become unresponsive. which is happening because there is no frame size define for view of inputAccessoryView.
class ChatInputContainerView: UIView, UITextFieldDelegate {
override var intrinsicContentSize: CGSize {
return CGSize.zero
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var inputTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "Enter message..."
textField.translatesAutoresizingMaskIntoConstraints = false
textField.delegate = self
return textField
}()
override init(frame: CGRect) {
super.init(frame: frame)
autoresizingMask = .flexibleHeight
self.inputTextField.leftAnchor.constraint(equalTo: rightAnchor, constant: 8).isActive = true
self.inputTextField.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor).isActive = true
self.inputTextField.rightAnchor.constraint(equalTo: leftAnchor).isActive = true
self.inputTextField.heightAnchor.constraint(equalTo: heightAnchor).isActive = true
}
}
following is controller where i am using inputAccessory View
class chatController: UITextFieldDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
lazy var inputContainerView: ChatInputContainerView = {
// let chatInputContainerView = ChatInputContainerView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 50))
let chatInputContainerView = ChatInputContainerView()
chatInputContainerView.chatLogController = self
return chatInputContainerView
}()
override var inputAccessoryView: UIView? {
get {
return inputContainerView
}
}
override var canBecomeFirstResponder : Bool {
return true
}
}
previously i was using following code to get size of InputAccessoryView which place the view at the bottom with fix height.
let chatInputContainerView = ChatInputContainerView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 50))
but now i am using following to set inputAccessoryView which is not working properly, textfield inside view become unresponsive because parent view have no size define.
override var intrinsicContentSize: CGSize {
return CGSize.zero
}
autoresizingMask = .flexibleHeight
in following image you can see all my control are now above the safeAreaLayout but they become unresponsive.
sample image
let me know if you do not understand. please help thank you in advance.
Try adding a top anchor to your 'inputTextField'
self.inputTextField.topAnchor.constraint(equalTo: topAnchor).isActive = true
I might be wrong but without knowing where the top is the 'ChatInputContainerView' will have zero height.

Display UIImage to the left of text in UITextField

I have a UITextField which spans the width of my view. I'd like to add a small image that sits directly to the left-most character entered in my UITextView.
Is that possible? From the docs, it looks like .leftView sits to the left-most position of the UITextField rather than directly to the left of the text as the user types.
Thanks
Write Below code to add left image in TextField
Class CustomTextField : UITextField {
/// A UIImage value that set LeftImage to the UItextfield
#IBInspectable open var leftImage:UIImage? {
didSet {
if (leftImage != nil) {
self.leftImage(leftImage!)
}
}
}
fileprivate func leftImage(_ image: UIImage)
{
rightPadding()
let icn : UIImage = image
let imageView = UIImageView(image: icn)
imageView.frame = CGRect(x: 0, y: 0, width: icn.size.width + 20, height: icn.size.height)
imageView.contentMode = UIViewContentMode.center
self.leftViewMode = UITextFieldViewMode.always
let view = UIView(frame: CGRect(x: 0, y: 0, width: imageView.frame.size.width, height: imageView.frame.size.height))
view.addSubview(imageView)
self.leftView = view
}
/// Give right padding to UITextField
fileprivate func rightPadding() {
let paddingRight = UIView(frame: CGRect(x: 0, y: 5, width: 5, height: 5))
self.rightView = paddingRight
self.rightViewMode = UITextFieldViewMode.always
}
}
Then after in storyboard select textfield give class name "CustomTextField" and then see in your attribute inspector select your image.
I hope it will help you.
Yes, you are correct about the leftView property of the UITextField - as far as I know it stays to the left of the textfield.
I would do it using autolayout and a separate UIImageView anchored to the right side of the textField and I would dynamically change the constant of the constraint to move it with text. You can determine the current width using answers in this SO Question.
I've created a simple example you can use as your starting point:
import UIKit
class CustomVC: UIViewController {
let textField = UITextField()
// use your image here
let imageView = UIImageView(image: #imageLiteral(resourceName: "your_image_here"))
var imagePositionFromRight: NSLayoutConstraint!
let imageOffset: CGFloat = CGFloat(4)
override func loadView() {
self.view = UIView()
view.backgroundColor = UIColor.lightGray
view.addSubview(textField)
view.addSubview(imageView)
// if alignment is .left, you can just use leftView property
textField.textAlignment = .right
textField.backgroundColor = UIColor.white
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
textField.translatesAutoresizingMaskIntoConstraints = false
imagePositionFromRight = textField.rightAnchor.constraint(equalTo: imageView.rightAnchor, constant: imageOffset)
NSLayoutConstraint.activate([
textField.rightAnchor.constraint(equalTo: view.rightAnchor),
textField.centerYAnchor.constraint(equalTo: view.centerYAnchor),
textField.leftAnchor.constraint(equalTo: view.leftAnchor),
imageView.topAnchor.constraint(equalTo: textField.topAnchor),
imageView.bottomAnchor.constraint(equalTo: textField.bottomAnchor),
imageView.widthAnchor.constraint(equalTo: imageView.heightAnchor),
imagePositionFromRight,
])
textField.delegate = self
}
}
extension CustomVC: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let proposedString = (textField.text as NSString?)?.replacingCharacters(in: range, with: string) ?? ""
textField.text = proposedString
let width = textField.attributedText?.size().width
imagePositionFromRight.constant = (width ?? 0) + imageOffset
// returning false since we updated text above manually
return false
}
}
P.S.: Consider adding the image view as a subview of the textField and setting textField.clipsToBounds = true, if the image view never exceeds the textField.

Get UITextView dynamic height with auto layout after setting text

I have a UITextView not scrollable with auto layout set by interface builder, and the text increase or decrease dynamically with no problem, but i want know what is the new UITextView height after setting text, i'm trying to do this:
NSLog(#"text before: %.2f",self.myText.frame.size.height);
[self.myText setText:self.string];
NSLog(#"text after: %.2f",self.myText.frame.size.height);
this is the result:
text before: 47.50
text after: 47.50
the text is increased in the view when i run it, but the size is the same, how i can get the real height after setting text?
All you have to do is:
set up all your constraints except the height one AND
set textView's scrollEnabled property to NO
The last part is what does the trick.
Your text view will size automatically depending on its text value.
If you prefer to do it all by auto layout:
In Size Inspector:
Set Content Compression Resistance Priority Vertical to 1000.
Lower the priority of constraint height for your UITextView. Just make it less than 1000.
In Attributes Inspector:
Uncheck Scrolling Enabled.
I have used the code given on following link AutoLayout with Dynamic UITextView height and it worked for me :)
This should work:
NSLog(#"text before: %.2f",self.myText.frame.size.height);
[self.myText setText:self.string];
[self.myText layoutIfNeeded]; // <--- Add this
NSLog(#"text after: %.2f",self.myText.frame.size.height);
Here's an example implementation on my Github: https://github.com/guillaume-algis/SO-27060338
Swift 3.0
textView.isScrollEnabled = false
This allow AutoLayout to do its job.
Use below code:
Objective-C Code
[textView setScrollEnabled:NO];
Swift Code
textView.isScrollEnabled = false
Just after changing the text call
[self.myText sizeToFit];
Unlike UILabel, UITextView's has no intrinsic size property. So how I did it was set up the UITextView's height constraint, hook it via IBOutlet, and change its value in textViewDidChange or when text changes.
#IBOutlet weak var textViewHeight: NSLayoutConstraint!
func textViewDidChange(textView: UITextView) {
// dynamic height adjustments
var height = ceil(textView.contentSize.height) // ceil to avoid decimal
if height != textViewHeight.constant { // set when height changed
textViewHeight.constant = height
textView.setContentOffset(CGPointZero, animated: false) // scroll to top to avoid "wrong contentOffset" artefact when line count changes
}
}
- (void)textViewDidChange:(UITextView *)textView
{
UIFont *myFont = [UIFont systemFontOfSize:14];
CGSize size = [self sizeOfText:textView.text widthOfTextView:TextviewWidth withFont:myFont];
NSLog(#"Height : %f", size.height);
}
-(CGSize)sizeOfText:(NSString *)textToMesure widthOfTextView:(CGFloat)width withFont:(UIFont*)font
{
CGSize ts = [textToMesure sizeWithFont:font constrainedToSize:CGSizeMake(width-20.0, FLT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
return ts;
}
select textview and uncheck "Scrolling enabled"
select textview from top menu "Editor > size to fit content"
select the view below it, set its top constraints with the textview bottom to whatever margin you want, then go to "Size Inspector",double click or edit the constraint you just added, and set the "Relation" to "Greater than or Equal"
Yet another approach is to use
myTextView.textContainer.heightTracksTextView = true
Which allows scroll to be enabled
Well, I haven't converted this code into swift4 syntax, but the logic will remain the same. This is an extension method for Xamarin.ios(C#).
public static nfloat GetEstimateHeight(this UITextView textView, UIView View)
{
var size = new CoreGraphics.CGSize(View.Frame.Width, height: float.PositiveInfinity);
var estimatedSize = textView.SizeThatFits(size);
return estimatedSize.Height;
}
The logic here that will work for swift is
var size = new CoreGraphics.CGSize(View.Frame.Width, height: float.PositiveInfinity);
var estimatedSize = textView.SizeThatFits(size);
var textViewFinalHeight = estimatedSize.Height;
Just an addition as per #Pavel Gurov's answer. If you already set up your height constraint, simply make it inactive. Also worth to call .sizeToFit() afterwards to make sure resize action is performed.
theTextViewHeightConstraint.isActive = false
theTextView.isScrollEnabled = false
theTextView.text = "some text"
theTextView.sizeToFit()
the textview height increase by using pure swift code design. I am just do coding part only.
I take this idea from
https://stackoverflow.com/a/45071002/9110213
First thing create the textView
import UIKit
class TextFieldCell: UITableViewCell {
lazy var btnEdit: UIButton! = {
let button = UIButton()
button.translatesAutoresizingMaskIntoConstraints = false
button.addTarget(self, action: #selector(self.actionEdit(_:)), for: .touchUpInside)
button.setTitle("Edit", for: .normal)
button.titleLabel?.font = UIFont(name: "ProximaNova-Medium", size: 18)
button.setTitleColor( UIColor(red: 0.29, green: 0.56, blue: 0.89, alpha: 1), for: .normal)
button.titleLabel?.textAlignment = .left
return button
}()
lazy var separatorView: UIView! = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
lazy var textView: UITextView! = {
let textView = UITextView.init(frame: .zero)
textView.translatesAutoresizingMaskIntoConstraints = false
textView.delegate = self
textView.isScrollEnabled = false
return textView
}()
lazy var titleLabel: UILabel! = {
let label = UILabel(frame: CGRect(x: 27, y: 318, width: 27, height: 12))
label.text = "Name"
label.font = UIFont(name: "ProximaNova-Medium", size: 10)
label.textColor = UIColor(red: 0.61, green: 0.61, blue: 0.61, alpha: 1)
label.textAlignment = .left
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
deinit {
self.titleLabel = nil
self.textView = nil
self.separatorView = nil
self.btnEdit = nil
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.addView()
self.setConstraint()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension TextFieldCell {
func addView(){
self.contentView.addSubview(self.btnEdit)
self.contentView.addSubview(self.titleLabel)
self.contentView.addSubview(self.textView)
self.contentView.addSubview(self.separatorView)
}
func setConstraint(){
// This part is very important to increase the textview height dyamically
let textViewHeight = self.textView.heightAnchor.constraint(equalToConstant: 27)
textViewHeight.priority = .defaultHigh
self.textView.setContentCompressionResistancePriority(.required, for: .vertical)
self.textView.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
NSLayoutConstraint.activate([
self.titleLabel.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: 27),
self.titleLabel.topAnchor.constraint(equalTo: self.contentView.topAnchor, constant: 38),
self.textView.topAnchor.constraint(equalTo: self.titleLabel.bottomAnchor, constant: 9),
self.textView.leadingAnchor.constraint(equalTo: self.titleLabel.leadingAnchor),
textViewHeight,
self.textView.trailingAnchor.constraint(equalTo: self.btnEdit.leadingAnchor, constant: -25),
self.btnEdit.centerYAnchor.constraint(equalTo: self.textView.centerYAnchor),
self.btnEdit.widthAnchor.constraint(equalToConstant: 40),
self.btnEdit.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor, constant: -33),
self.separatorView.topAnchor.constraint(equalTo: self.textView.bottomAnchor, constant: 10),
self.separatorView.heightAnchor.constraint(equalToConstant: 1),
self.separatorView.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor),
self.separatorView.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor, constant: 27),
self.separatorView.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor, constant: -15),
])
}
}
extension TextFieldCell {
#objc func actionEdit(_ sender: UIButton) {
}
}
extension TextFieldCell: UITextViewDelegate {
func notifyViewController(text:String){
}
func textViewDidEndEditing(_ textView: UITextView) {
}
}

Resources