我有一個plist,我想要在uipickerview中獲取內容。從plist到UIPickerView
我能夠輸出的plist中使用控制檯的內容:
// Path to the plist (in the application bundle)
NSString *path = [[NSBundle mainBundle] pathForResource:
@"loa" ofType:@"plist"];
// Build the array from the plist
NSMutableArray *array2 = [[NSMutableArray alloc] initWithContentsOfFile:path];
// Show the string values
for (NSString *str in array2)
NSLog(@"--%@", str);
什麼,我需要搞清楚的是如何得到這個內容到UIPickerView。
我試過如下:
arrayPicker = [[NSMutableArray alloc] initWithArray:array2];
,卻得到一個錯誤:exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance
感謝您的幫助
plist中是用字典並4串爲每個項目Array的字典中。我嘗試了類似於上面的內容,但一直未收到未聲明的錯誤「myArray」。 – hanumanDev