I'm currently trying to learn Cocoa/Objective-C to build Mac OS X softwares. I come from Delphi, and in Delphi a really really useful element is the TStringList. I'm looking for an equivalent in Objective-C... I need to be able to access an item (one line) in the virtual list.

For example, in Delphi I can call Label.Caption := MyStrList[5]; to display (as a String) an item in the list. I would like to do "the same" thing in Cocoa.

For info, I used TStringList in Delphi to manage the list of operations that my multi-threaded applications had to do.

Thanks in advance !

Beny

有帮助吗?

解决方案

Its NSArray (or NSMutableArray) with NSString objects in it. You can write something like

NSArray *array=[NSArray arrayWithObjects:@"string1",@"string2",@"string3",nil];
label.text=[array objectAtIndex:1];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top