Trouble getting NSString from NSDictionary key into UILabel

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-04-25T17:56:03Z Indexed on 2010/04/25 18:03 UTC
Read the original article Hit count: 548

Filed under:
|
|
|

I'm attempting to put the value associated with the key called "duration" into a UILabel but I'm getting a blank or "(null)" result showing up in the UILabel.

My NSDictionary object with its keys seems to be logging as being full of the data and keys I think I want, as such:

the content of thisRecordingsStats is { "12:48:25 AM, April 25" = {

FILEPATH = "/Users/brian/Library/Application Support/iPhone Simulator/3.1.3/Applications/97256A91-FC47-4353-AD01-15CD494060DD/Documents/12:48:25 AM, April 25.aif";

duration = "00:04";

applesCountString = 0;

...and so on.

Here's the code where I'm trying to put the NSString into the UILabel:

cell.durationLabel.text = [NSString stringWithFormat:@"%@",[thisRecordingsStats objectForKey:@"duration"]];

I've also tried these other permutations:

cell.durationLabel.text = [thisRecordingsStats objectForKey:@"duration"];

and I've also tried this tag-based approach:

label = (UILabel *)[cell viewWithTag:8];
 label.text = [[thisRecordingsStats objectForKey:@"duration"] objectAtIndex:1];

and:

UILabel *label; label = (UILabel *)[cell viewWithTag:8]; label.text = [NSString stringWithFormat:@"%@",[[thisRecordingsStats objectForKey:@"duration"] objectAtIndex:1]];

I've also tried creating a string from the key's paired value and see a "(null)" value or blankness using that too.

What am I missing? I assume it's something with the formatting of the string. Thanks for looking!!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uilabel