2013-01-12 22 views

回答

0

您需要設置一個對象作爲NSTextField的代表。由於NSTextFieldNSControl的子類,因此如果實現該方法,它將在您的對象上調用-controlTextDidChange:方法。

@interface MyObject : NSObject 
{ 
    IBOutlet NSTextField* textField; 
} 
@end 

@implementation MyObject 
- (void)awakeFromNib 
{ 
    [textField setDelegate:self]; 
} 

- (void)controlTextDidChange:(NSNotification *)aNotification 
{ 
    if([notification object] == textField) 
    { 
     textField.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14]; 

    } 
} 
@end 
相關問題