Post

Replies

Boosts

Views

Activity

Using NSTextFieldDelegate with NSSecureTextField
Hi, I've been making good progress with learning how to use NSTextFieldDelegate with NSTextField, but I'm struggling with how to use it with NSSecureTextField. Can anyone point me in the right direction? I need to be able to grab the stringValue and work with it when the return key is pressed. The code below works fine for an NSTextField. I obviously need to use a different function, or a different responder type perhaps? func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {       if (commandSelector == #selector(NSResponder.insertNewline(_:))) {    guard let sender = control as? NSSecureTextField else {return false}    if sender.tag == 1 {     print("It equals 1")    }         if sender.stringValue != "" {       print("field is not empty")      }      self.view.window?.makeFirstResponder(sender.nextKeyView)            return true    }    return false  }
Topic: UI Frameworks SubTopic: AppKit Tags:
1
0
738
Oct ’22
ControlTextDidEndEditing (how to determine which textfield called)
Hi, I have a number of NSTextFields on a ViewController and I'm searching for a way to determine which textfield called the DidEndEditing method. Is there a way to do it without adding an IBOutlet for each TextField? func controlTextDidEndEditing(_ obj: Notification) {      } Also, the IBOutlet question raises another question. Is there an equivalent of UIKits IBOutletCollection for AppKit? I've been googling away but haven't found much about it so far. Cheers for any help.
Topic: UI Frameworks SubTopic: AppKit Tags:
1
0
519
Oct ’22
How to print a QRCode to the proper size?
Hi, I'm having trouble printing a QRCode to the proper size. I pass it, as a UIImage, to a UIActivityViewController and it prints, but at the full width of the A4 page. I've been looking into all kinds of ways to try and shrink it down, but without success. Is there an image equivalent of UISimpleTextPrintFormatter or something along those lines that makes it simple? Do I need to use a UIViewPrintFormatter? Any help greatly appreciated.
0
0
661
Aug ’21
Programmatically closing an app.
Here's my context: User imports a backup file via airdrop, from a laptop to the mobile. My app opens and asks for a password to import and decrypt the file. The user decides to cancel instead, so taps the cancel button. How do I close the app at that point? I have done a lot of googling but so far have not found out how to do it.
10
0
19k
Jan ’21
Passwords and the need for a random salt.
Hi. I have a question about whether or not a random salt is necessary when there is no centralised database for hackers to attack. It's pretty clear that it's necessary when there is, but is it important when the users simply backup their data to a password encrypted file in a place of their choosing? Is it possible for someone with malicious intent to extract a hardcoded salt from a compiled app?
1
0
1k
Sep ’20
How to disable UIAlertController Buttons?
Hi all, I'm struggling to find a way to disable buttons in a UIAlertController of .alert style. I have a textfield, for entering the current password, a button for changing the current password and a button for deleting it. I'd like to disable both password buttons until the current password is correctly entered into the textfield, but I'm struggling to find the solution. If anyone can point me in the right direction it would be much appreciated.
Topic: UI Frameworks SubTopic: UIKit Tags:
7
0
5.4k
Nov ’19