Link to home
Start Free TrialLog in
Avatar of varBoomer
varBoomer

asked on

Programmatically Add UI Controls in Objective-C

I'm pretty new to Objective-C, but I do understand a lot of the syntax and the way it handles objects through messages.  But that's about it.  

One thing I'm trying to learn is how to add UI controls programmatically and I found some sample code to try and do this.  However, I'm not sure what method I need to "paste" the following code into.  It's for an NSButton.  

This is the sample code I found:
NSView *superview = [window contentView]; 
NSRect frame = NSMakeRect(10, 10, 200, 100); 
NSButton *button = [[NSButton alloc] initWithFrame:frame]; 
[button setTitle:@"Click me!"]; 
[superview addSubview:button]; 
[button release];

Open in new window


Any help is appreciated!
Avatar of varBoomer
varBoomer

ASKER

Wow, no response in quite some time... Either there is another forum somewhere that is specific to apple or my question just makes absolutely no sense at all...  Whatever the reason is for no response, please let me know!
ASKER CERTIFIED SOLUTION
Avatar of pgnatyuk
pgnatyuk
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial