On 12 Apr 2022, at 15:23, Jens Alfke <jens@...> wrote:
On Apr 9, 2022, at 11:59 PM, Gerriet M. Denkmann <gerriet@...> wrote:
I have a textField which is output only (editing makes no sense at all) but the user might want to select, copy and paste the content.
On iOS the idiomatic way to do this is not selecting the text, but a long-press gesture that brings up a context menu with a Copy item.
So first I enabled isUserInteractionEnabled for my UILabel.
Then, In viewDidLoad() I added:
let interaction = UIContextMenuInteraction(delegate: self)
myLabel.addInteraction(interaction)
Long-press on my UILabel works fine on iPhone and iPad. Somehow idiomatic. What I really expected: double click on my label (or long-press) and get a standard menu on top with: Copy, Look Up, Translate, etc.
And on Mac (using Catalyst): a control-click also gets my context menu.
Thanks for your suggestions!
Gerriet.