Is it possible to update the title in UIPasteControl

Viewed 98

By default title in UIPasteControl, it appears as Paste, but I have not found any property to modify the title.

let config = UIPasteControl.Configuration()
        config.baseBackgroundColor = .brown
        config.baseForegroundColor = .white
        config.cornerRadius = 2.0
        config.displayMode = .labelOnly
        let pasteControl = UIPasteControl(configuration: config)
        pasteControl.target = self
        pasteConfiguration = UIPasteConfiguration(acceptableTypeIdentifiers: [
            UTType.text.identifier,
            UTType.image.identifier,
        ])
        
1 Answers

As of now you can’t change the title of the UIPasteControl button. You are limited to the given options (a localized equivalent for the text „Paste“, an icon or both). And I don’t expect that this will change in the future.

This new UIPasteControl is designed with security in mind. I makes sure that the user can not be manipulated to do something he/she doesn’t want, for example if the App provides a misleading text label. The button will even disable itself if it is partly hidden or too small to show its text label or icon completely. It also disables itself if it is attached to a textfield (in which the content of the clipboard would be copied in) and this textfield is not fully visible or editable.

Related