KennethTsang / GrowingTextView

An UITextView in Swift. Support auto growing, placeholder and length limit.
MIT License
1.07k stars 133 forks source link

Not working on os11 ? #22

Closed justdan0227 closed 6 years ago

justdan0227 commented 6 years ago

Just copied the source into my project, dropped a textview onto my viewcontroller, changed the class to GrowingTextView and when I run, the keyboard overlays the textview?

So in my case I have a tableview and want to add this at the bottom. I created a view, dropped a textview in it (just as in the example 2). What I don't understand is how this resizes the tableview while the keyboard is open?

justdan0227 commented 6 years ago

So I "got this working" in the example adding a tableview to Example 2. However in the example it ties the constraint to the BottomLayout which is now deprecated and we are told to use safe area. How does this get updated to use save area of xCode 9.2 vs the BottomLayout ?

KennethTsang commented 6 years ago

I have update all 3 examples with new auto layout implementation. You may take a look.

justdan0227 commented 6 years ago

AWESOME! thanks.. looking it over now.. Constraints are "great" but boy in IB they are so confusing.

justdan0227 commented 6 years ago

That appears to work.. Can you add and example 2b which would put a table view above the control. I'm attempting to do that and not sure if it all needs to be in a view and where the bottom contraint would be such that the tableview would resize and textview move up when keyboard is shown

KennethTsang commented 6 years ago

Add a constraint that make your tableview's bottom equals to toolbar's top, then it should works.

justdan0227 commented 6 years ago

Wow that "appears" to work however. I took Example2 and simply added a tableview before the inputtoolbar and it appears to work just fine without messing with the constraint? 1 final thing; how can I scroll to the bottom of the list when the growingtext appears? Is there a delegate method that gets called by growing text?

KennethTsang commented 6 years ago

Are you sure it is working? I think you have to add constraint for that. Anyway, regarding your question, what do u mean "when the growingtext appears"? I guess you are talking about "keyboard appears", right? You need to implement keyboard observer in your ViewController (like Example2), then you may call tableView.scrollToRow(at: indexPath, at: .bottom, animated: true) when keyboard appears.