Closed mergesort closed 9 years ago
You can ignore me. I don't know why I didn't think to just wrap it in a UIScrollView, that worked great.
Still enjoying the library. :)
@mergesort I'm glad that wrapping in a UIScrollView worked! Still, it's a nice thought to add that to be built-in to CLTokenInputView. Right now it's very basic. I'm glad you're using it though! Have no idea how many people are actually using it!
@rsattar It's working really nicely actually, thanks! There is one bug though, https://github.com/clusterinc/CLTokenInputView/issues/2.
Just a suggestion, you can open a request that asks people to show off their implementation, ala https://github.com/dzenbot/DZNEmptyDataSet/issues/4.
Are you sure it really worked that simple. I added the the CLTokenView on a scrollview, with constraints to top, bottom, leading and trailing, and it didn't work. I also tried removing the bottom constraint and adding a height updating its value every time didChangeHeightTo was called and it didn't work either.
@rsattar @mergesort hi guys i am trying to add scroll to CLTokenInputView and i tried all ways that i knew but it wont work. well i'm coding with swift just for 3 months. please help me in this tnx.
@mergesort Could you please indicate how you were able to make it work with an scrollView?
@Abreu0101 @lordaltair Honestly I don't really remember, it's been a long 3 years.
For future reference: I was able to do it in the following way: Have the following view hierarchy: -containerScrollView --scrollView ---contentScrollView ----CLTokenInputView (tagInputView)
Basically attach the CLTokenInputView
to the contentScrollView (avoid the bottom):
tagInputView.topAnchor.constraint(equalTo: contentScrollView.topAnchor).isActive = true tagInputView.leftAnchor.constraint(equalTo: contentScrollView.leftAnchor).isActive = true tagInputView.rightAnchor.constraint(equalTo: contentScrollView.rightAnchor).isActive = true
Add constraints to the contentScrollView (Height is the important constraint):
contentScrollView.topAnchor.constraint(equalTo: scrollView.topAnchor).isActive = true contentScrollView.leftAnchor.constraint(equalTo: scrollView.leftAnchor).isActive = true contentScrollView.rightAnchor.constraint(equalTo: scrollView.rightAnchor).isActive = true contentScrollView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true contentScrollView.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true contentScrollView.heightAnchor.constraint(equalTo: tagInputView.heightAnchor).isActive = true
Add constraints to the scrollView (just attached the container):
scrollView.topAnchor.constraint(equalTo: containerScrollView.topAnchor).isActive = true scrollView.leftAnchor.constraint(equalTo: containerScrollView.leftAnchor).isActive = true scrollView.rightAnchor.constraint(equalTo: containerScrollView.rightAnchor).isActive = true scrollView.bottomAnchor.constraint(equalTo: containerScrollView.bottomAnchor).isActive = true
Add constraints to the container of the scrollView (important here is the constrains of heights between 45-100 for my case and the low priority height constraint to the tagInputView):
containerScrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true containerScrollView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true containerScrollView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true containerScrollView.heightAnchor.constraint(greaterThanOrEqualToConstant: 45).isActive = true containerScrollView.heightAnchor.constraint(lessThanOrEqualToConstant: 100).isActive = true
let containerScrollViewHeightLowConstraint = containerScrollView.heightAnchor.constraint(equalTo: tagInputView.heightAnchor) containerScrollViewHeightLowConstraint.priority = .defaultLow containerScrollViewHeightLowConstraint.isActive = true
Hi there, really enjoying the library, but was wondering about a feature. My view is constrained to a cell, so it has a fixed height which it will never grow past. Is there a way that it can be made to scroll, if the content size is greater than the view's bounds?
I didn't see a clear way to implement it the demo, nor when reading through the code.
Thanks a lot!