Open yarodevuci opened 7 years ago
hi @yarodevuci,
is this when the keyboard first pops up, or are you unable to scroll the message for it to appear fully in view?
@adamsrosco That's when keyboard is up and I press send button. That's how new message appears
@adamsrosco or @dzenbot Any word on that?
How were you able to make the text inside of the label have a cushion around it? my label shrinks to the size of the text and ends up looking like this. I used the pod to create a app that talks with cleverbot.
@yarodevuci you have to shift your content view of the tableView so the tableView will appear to shift higher. So you would need to monitor the UIKeyboardShown and dissappear events, and shift the keyboard.
@Smnelson13 are you using the AL chat cells to generate your chat bubbles?
@yarodevuci Sorry, read your post again, are you using height for row at index path in your project to cater for older iOS versions? I used dynamic layout on the cells and took out the heightforrow, i found that i kept getting a issue on my last chat message wrt sizing, so the cell would always also appear behind the keyboard.
NB: when using autolayout and dynamic sizing, dont forget to set the estimatedRowHeight, then your cells shouldnt appear behind the keyboard anymore.
@adamsrosco I use UITableViewAutomaticDimension height for row.
and tableView.estimatedRowHeight = 125
Can you please specify more details how I can use dynamic layout on the cells and dynamic sizing?
Funny part that it does not happens every time, it happens randomly. And it's very annoying.
It looks like you are already using autolayout. When you run in the simulator do you get any layout warning messages? That could indicate there's atleast one constraint that may be the cause of that.
@adamsrosco no I don't have any errors when it happens.
here is the screen of my constraints
mm... I will have to check this again. I do have a project implementing the controller again, and can have a look at it then. Will be about 3 weeks from now though.
out of interest, is there a need for the autocorrect/autosuggest bar to show, i've disabled this in the past so the content size adjusts correctly. I am wondering in the slack controller takes this into account... it might solve your problem in the short term.
@adamsrosco I don't see any autocorrect bar on mine . Cool I can wait, let me know later
@adamsrosco any updates so far?
@adamsrosco I figured it out, my solution was to create a class that gives CGFloat4 points of cushion around the whole text. that was the easiest way I personally found.
@Smnelson13 Hi, I am totally lost of what you just said. Can you please explain in more details ?
@yarodevuci Sorry, i was on my phone and tried to summarize it. `class InsetLabel: UILabel { let topInset = CGFloat(4) let bottomInset = CGFloat(4) let leftInset = CGFloat(8) let rightInset = CGFloat(8)
override func drawText(in rect: CGRect) { let insets: UIEdgeInsets = UIEdgeInsets(top: topInset, left: leftInset, bottom: bottomInset, right: rightInset) super.drawText(in: UIEdgeInsetsInsetRect(rect, insets)) }
override public var intrinsicContentSize: CGSize { var intrinsicSuperViewContentSize = super.intrinsicContentSize intrinsicSuperViewContentSize.height += topInset + bottomInset intrinsicSuperViewContentSize.width += leftInset + rightInset return intrinsicSuperViewContentSize } } `
I run my text through this to get the border effect I wanted. UsingCGRect I created insets and inserted them around the text.
@Smnelson13 So basically u hard coded that?, In my case I am using custom UITableViewCell xib
@yarodevuci I used a xib as well, when I used the xib I still encountered this problem so by doing what i listed above I fixed the issue.
@Smnelson13 So basically you got rid of xib and replaced it via code based? In that case how did you use that class? U manually create a view with text and how u put it in table view?
@yarodevuci I made the class of the Xib insetLabel if that's what you mean.
@Smnelson13 By any chance do u have a full example of your code?
@yarodevuci https://github.com/Smnelson13/NotSoCleverBot.git
@Smnelson13 Thank you!! I ll take a look
@Smnelson13 I like your approach a lot! However, I am using label inside view so your method did not helped me. But i am thinking to get rid of the view container and leave just a label
Hi,
our work with the controller has been pushed out. I need to have a look at your code again. How are you setting up your tableview in relation to the input field.
is the table up against the input view, or is the input view over the table?
Regards, Rosco.
@adamsrosco , how do I check that? I am setting it up just like example does, and am using my custom cell xib for messages, that also have bottom label for delivery status.
@yarodevuci I see that you were able to use dynamic heights for your custom cell. I'm trying to do the same. I try to do the following in viewDidLoad: tableView.estimatedRowHeight = 44 tableView.rowHeight = UITableViewAutomaticDimension
And then this: override func tableView(_: UITableView, heightForRowAt _: IndexPath) -> CGFloat { return UITableViewAutomaticDimension } override func tableView(_: UITableView, estimatedHeightForRowAt _: IndexPath) -> CGFloat { return 44 }
But this renders my label with a height only enough to view 1 line. I have no. of lines on the label set to 0, and I'm seeing no auto-layout constraint issues. I have only the trailing, leading, and top for the said label.
Any idea what might I be missing? Help is much appreciated!
@johndoehelloworld have u set all the constraints like leading trailing , bottom and top?
@yarodevuci Yes I did..I can't for the life of me figure out why it isn't working.. Did you do anything non standard to make this work?
@johndoehelloworld can u attach some screenshots of ur constraints and actual tableViewCell ?
The second and third sreenshots correspond to the message label that needs to grow vertically to fit content. Thanks for your time!
If you would like I can send you a Xib file that I use. I'm my newer most up to date project that I'm using this my contains are set to be greater than or = to something. You have your label constrains set but I think it might not be able to grow due to the fact the constrains are set to a exact number. By using greater than or = to you can make a constraint grow and change as need be. Then set lines to 0.
Sent from my iPhone
On Aug 2, 2017, at 2:36 AM, johndoehelloworld notifications@github.com wrote:
The second and third sreenshots corresponds to the message label that needs to grow vertically to fit content. Thanks for your time!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Hi @Smnelson13 – can you please share with me you XIB? Thanks for offering! Are you sure you aren't talking about >= in terms of height? My constraints are about pinning the edges of the label to the sides rather than describe it's height. But again, I might be missing something. Any help is much appreciated. Thanks again!
@yarodevuci : Thoughts on my screenshots? Thanks in advance for your time!
@Smnelson13 For instance, see this screenshot: I increased the height of the cell in IB, and the label grows.
What I did is put a label on the left or wright depending on the user. The label has constraints that explicitly set on top and left. The bottom and right side are >= and line set to 0. I can send the xib when I get home to my computer.
Sent from my iPhone
On Aug 2, 2017, at 9:51 PM, johndoehelloworld notifications@github.com wrote:
@Smnelson13 For instance, see this screenshot: I increased the height of the cell in IB, and the label grows.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Most of the time if the message has new lines it ends up partially hidden behind the keyboard. Any ideas how to fix that? @dzenbot