Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

magda1986

macrumors newbie
Original poster
Mar 5, 2011
6
0
Hello,

I'm trying to find a way to nicely create buttons dynamically. The following image describes pretty well the result I'm aiming to obtain:

tagitSplash.png


I've made the following with the interface builder:
picture.php


Clicking the "List" button creates a NSMutableArray with the contents of the "test.txt" file. Good so far. Now I would like to create one button per entry in that array and make these appear like they do in the "tags application" I used as an example.
I'd like to write the following in objective-c: "please put the buttons side by side in the NSBox".

For the record, this is my best guess so far... nothing happens though :(
Code:
NSRect frame = {{0.0, 0.0}, {50.0, 20.0}};
NSButton *myButton = [[[NSButton alloc] initWithFrame: frame] autorelease];
[tagBox addSubview: myButton];
[myButton setTitle: @"OK"];

That's where I'm stuck and need your help!

Thanks for your time,
Mag.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.