Requirements
I want to implement the option to hide password input in a custom NSTextView
. String data should be set to the underlying model - though it should not be displayed in the view. Instead bullets or nothing at all should be displayed. There should also be the option to show the password.
Experiments
Therefore, I am searching for a delegate method that notifies me when text has been entered. The closest method I found by now is the following.
textViewDidChangeSelection: // NSTextViewDelegate
I tried the following methods to alter the text of the textStorage
- without success.
shouldChangeTextInRange:replacementString: // NSTextView
replaceCharactersInRange:withString: // NSTextStorage
setAttributedString: // NSTextStorage
setString: // NSText
Questions
- What delegate method would be suitable?
- How can I substitute the displayed text without changing the model data?
Disclaimer
I am developing an application with a dark user interface. So, I need to change back- and foreground colors. There are annoying problems like coloring the text cursor that cannot be done with an NSTextField
. That's why I want to implement the secure text field with an NSTextView
.