UITextView link not clickable iOS 8 -
i followed : uilabel , nslinkattributename: link not clickable , uitextview link clickable, when click it, safari doesn't open no avail.
i have :
uitextview.attributedtext = ... attributed string "http://google.com" ...
"links detection", "selectable" , "user interaction enabled" enabled. "editable" disabled.
i implemented uitextviewdelegate
- (bool)textview:(uitextview *)textview shouldinteractwithurl:(nsurl *)url inrange:(nsrange)characterrange { return yes; }
however, link appears blue when click, nothing happens.
i had same issue. nothing did help.
the problem was, added uitextview scrollview , used sizetofit
.
for example: had view.frame
(0,0,320,440). , scrollview contentsize (0,0,320,1000) , links in view.frame
works when scroll down - not.
than tried check view selecting when scroll down , tap on uitextview. added uitapgesturerecognizers , find out when tap in bounds of self.view frame in bounds of uitextview tapped on uitextview. when scroll down - tap recognize tap on scrollview. in other words frame of uitextview clips self.view bounds.
edit: found problem:
i had view - scrollview - contentview - elements
hierarchy. there time, when scrollview bigger contentview, link can tapped in bounds of contentview. to fix this deleted contentview , place elements scrollview. hope answer somebody:)
Comments
Post a Comment