I’m just getting the basics down for objective c.
I want to create a textfield whose string is the same as the title of the dropbox cell I choose.
I have:
- (IBAction)dropbox:(id)sender{
NSPopUpButtonCell *sampleCell = [sender selectedCell];
[self setWord:@"%@",sampleCell.title];
[sampleCell release];
}
where word is declared as
@property (readwrite, nonatomic, retain) IBOutlet NSTextField *word;
@synthesize word = _word;
apparently I’m not allowed to have the placeholder argument when using [self setWord:]. Can you point me in the right direction?
First of all, you haven’t gained ownership of
sampleCellso you should not be releasing it. This will trigger an exception. Also, you’re setting an NSTextField to a string.This is what i would do: