I have 1 UITextfield
for password in my iPhone application.
I want to validate this textfield with the following validation.
Use the control:isValidObject:
method of the NSTextFieldDelegate
protocol which allows you to validate the value of a NSTextField. Assuming you have all your interface builder bits and pieces configured correctly, you might do something like this:
@interface PreferencesController : NSWindowController {
IBOutlet NSTextField *username, *password;
}
@end
@implementation PreferencesController
- (BOOL)control:(NSControl *)control isValidObject:(id)object
{
if (control == password) {
// Perform validation and return YES or NO
}
return YES;
}
@end