Flickr Assignment Problems

43 views
Skip to first unread message

Jeffrey Lee

unread,
May 13, 2012, 7:39:42 PM5/13/12
to iphone-appd...@googlegroups.com
I'm struggling a bit with assignment 4. I'm pulling the content value from the description dictionary for the description. Often, it comes back as blank, yet, I test for nil and "" in order to replace blanks with "Unknown", but that test never returns as true. What other sort of blank could be returned?
___________________________
Jeffrey Lee
http://www.jeffreyalanlee.com
jle...@gmail.com




David Barton

unread,
May 14, 2012, 3:41:51 AM5/14/12
to iphone-appd...@googlegroups.com

Hi,


I am using the following code snippet, which seems to work I think…./


// Get a handle to the photo's title and description

NSString *photoTitle = [photosInPlace objectForKey:TITLE_KEY]; 

NSString *photoDescription = [photosInPlace valueForKeyPath:DESCRIPTION_KEY];


// If the photo title is available set the cell's title to photoTitle and the cell's 

// subtitle to the photo description

if (photoTitle && ![photoTitle isEqualToString:@""]) {

cell.textLabel.text = photoTitle;

cell.detailTextLabel.text = photoDescription;

// else if the photo description is available set the title equal to it

} else if (photoDescription && ![photoDescription isEqualToString:@""]) { 

cell.textLabel.text = photoDescription;

cell.detailTextLabel.text = @"";

// else set the title to Unknown

} else {

cell.textLabel.text = @"Unknown";

cell.detailTextLabel.text = @"";

}


Are you using isEqualToString do to the comparison?

Jeffrey Lee

unread,
May 14, 2012, 9:18:25 AM5/14/12
to iphone-appd...@googlegroups.com
Doh!

No, I was doing a straight comparison, which probably checks if the objects are the same objects, vs. if they contain the same values.

___________________________
Jeffrey Lee




--
You received this message because you are subscribed to the Google Groups "iPhone Application Development Auditors" group.
To view this discussion on the web visit https://groups.google.com/d/msg/iphone-appdev-auditors/-/s7IL-_G4NdQJ.
To post to this group, send email to iphone-appd...@googlegroups.com.
To unsubscribe from this group, send email to iphone-appdev-aud...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/iphone-appdev-auditors?hl=en.

Reply all
Reply to author
Forward
0 new messages