I use the following code to display label value from a plist with an array of dictionaries:
seventyfiveclLabel.text = [NSString stringWithFormat:@"Kr. %@",[selectedObject valueForKey:@"75 cl price"]];
Can I display the label if the key exists in the reprecented dictionary, and leave it blank if the key doesn’t exist (or maybe if i does exist but has the value 0?)? Or leave it blank if i does, exist but has a specific value (0)? I ask because I have 100 wines (dictionaries) in the plist, some of them come in 75 cl and some of them doesn’t.
The way I usually go about something like this would be to do something like the following:
This way, if the key doesn’t exist, it defaults to a blank string. If the key does indeed have a value, it inserts that instead. I hope this helps