I am working on an app that loads small chunks of HTML into several webviews. I want this HTML to be selectable by the user, so they can copy and paste portions of it. This is working totally fine, but only when the content is greater than 100px
tall. For some reason, if it is any shorter, the content can not be selected by the user.
Steps to reproduce:
- Create a UIWebView with a width of 322, and a height of 100 and add it to a view
- Call
loadHTMLString: "W " * 64, baseURL: nil
on the webview. (on my screen this is 4 complete rows of "W"s) - Click and hold on one of the "W", note that the copy/paste menu does not appear
- Call
loadHTMLString: "W " * 65, baseURL: nil
on the webview. (on my screen the last "W" is on the 5th row) - Click and hold on one of the "W", note that the copy/paste menu does appear
I've tried a number of thing, to understand what is happening here. I you follow the same steps, but start with a height of 101 instead of 100, it works perfectly find with only 4 rows.
I think this might be a bug in iOS? Maybe?
I'm running iOS 9.2
, with Xcode 7.2.1
Does anyone here know why this might be happening, or if there is any sort of work around that I can use to fix this?