NSArray的设置和数据源的概念



我需要一些nsarray和quickicker的帮助

我有一个由a,b,c,d列组成的数据表m1 m2 m3 m4行表中的每个单元格有2个值——上限和下限

单元格m3 b的值为20和25例如

对不起,如果这不是很清楚,我想插入一张桌子的图片,但我没有足够的声望点来这样做

无论如何,我只是想在一个视图中表示这个数据表,因此组件0有m1,m2,m3等行组件1有a,b,c,d等列2和3列显示上限和下限

我认为这样做需要一个2d数组,但我不知道如何正确创建数据源

谁能告诉我

多谢

随函附上我对几周前所提问题的解答也许对别人有用谁知道呢?

进入我的视图didload

    //integer to hold the current row of component 0, this is set to "0" when the view loads.
component0 = 0;
component1 = 0;
    // get the plist
NSString *path = [[NSBundle mainBundle ] pathForResource:@"mywheelsdata" ofType:@"plist"];
    // Assign the contents of the plist to a NSDictionary for processing
mypickervalues = [[NSDictionary alloc] initWithContentsOfFile:path];
    // Creats an array from the keys which we will then use as labels in the picker.
NSArray *sortArray = [[NSArray alloc] initWithArray:[mypickervalues allKeys]];
wheelone = [[NSArray alloc] initWithArray:[sortArray sortedArrayUsingSelector:@selector(localizedStandardCompare:)]];
[sortArray release];
NSArray *sortArray2 = [[NSArray alloc] initWithArray:[[mypickervalues objectForKey:[wheelone objectAtIndex:component0]]allKeys]]; 
wheeltwo = [[NSArray alloc] initWithArray:[sortArray2 sortedArrayUsingSelector:@selector(localizedStandardCompare:)]];
[sortArray2 release];

    // setup uipicker and assign to myPicker
myPicker = [self setupPicker];
    // Loads the data linked to the appropriate field in the table of data supplied.
wheelthree = [[NSMutableArray alloc] initWithArray:[[mypickervalues objectForKey:[wheelone objectAtIndex:component0]] objectForKey:[wheeltwo objectAtIndex:component1]]];

希望有人能对上面的代码提出建议,但到目前为止,它似乎对我来说还可以

相关内容

  • 没有找到相关文章

最新更新