apploft/ExpandableLabel

Clicking on "More" doesn't work on larger iPhones

mrferris opened this issue · 4 comments

The expanding functionality is working great for me on an iPhone 7 and smaller.

On an iPhone 8, the expanding is only triggered if the user clicks toward the top of the "More" button, higher than a user would typically touch on a button.

On phones larger than that, such as the iPhone XS and 11, the "More" button doesn't work at all.

The ExpandableLabel instance in question is created in Storyboard. It has AutoLayout constraints set on it in Storyboard. Its delegate, numberOfLines, and text are set in Swift via an outlet. I have not changed the attributed text.

  • ExpandableLabel CocoaPod v0.5.2
  • Swift 4.2
  • XCode 11.3

Any tips or thoughts would be appreciated.

For anyone else finding this, I ended up forking this repo and modifying the check(touch: UITouch, etc....) function to do a simple "is this touch in the vicinity of the bottom right side of the UILabel?" check via the touch point coordinates and the label view's bounds. On master it uses the characterIndex() function which was behaving very wrong, and seems overly-complex to me.

I've come to the conclusion that this entire library should inherit from UITextView instead of UILabel, which would allow it to use the much simpler solution of a function handler assigned to an NSAttributedString.

Any thoughts still appreciated.

I have another issue like: Small device can't show "more" text.
Finally, after read this library source code, I found this is calculated by frame, I have to re-set value of label in func layoutSubViews to make sure frame size is correct when I set value for label, and it works well.
I guess we have the different issues, but the same reason. Please try it?
Hope it helpful.

And one more thing text is truncated from top when there is no "more" or "less" in the text. I think it has something to do with expanded and collapsed gets created. Any advice will be appreciated.

Anyone get an update on it. ...More appears to be working however CLOSE OR LESS does not show up.