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

beesbane

macrumors newbie
Original poster
Hi,

I have loaded in a plist, and nothing is crashing. I need to direct a UILabel to change to the plist's value, but can't seem to link that part right.

label.text = [valueForKey😡"value"];

This is right, but how do I tell it which item number in the list this is from?
beesbane is offline Reply With Quote
 
Code:
label.text = [valueForKey:@"value"];

This is right...
No, it's not right. You are trying to call an instance method but have not specified which instance to call it on (i.e. your message has no receiver).
 
it is in a button action. I was just wondering if there was a way to call specifically in the plist:

item 0
title
"value for title"

how would that be written?
 
an Array and a String

Code:
- (id)initWithLibraryName:(NSString *)libraryName {
    if (self = [super init]) {
        libraryPlist = libraryName;
        libraryContent = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] 
                                                                  pathForResource:libraryPlist ofType:@"plist"]];
    }
    return self;
}
 
valueForKey: is used with NSDictionary not NSArray.

EDIT: It might help if we can see the structure of your plist as well.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.