I’m loading a detailed view of an article when clicking on a row in a UITableView. When clicked, it loads the object with the data and I pass that object to the next controller being pushed on the stack. However, when I do this:
- (void)showArticle
{
[aTitle setText:[[self article] title]];
[aTitle setBackgroundColor:[UIColor clearColor]];
[[self view] addSubview:aTitle];
[aCategory setText:[[self article] category]];
[aCategory setBackgroundColor:[UIColor clearColor]];
[[self view] addSubview:aCategory];
[aAuthors setText:[[self article] authors]];
[aAuthors setBackgroundColor:[UIColor clearColor]];
[[self view] addSubview:aAuthors];
}
The title shows up fine, but the category and authors aren’t showing up. When I debug, I’m getting “out of scope” when I look at the values of the category/authors. The article object is being @synthesized and I’ve checked it and it has the right data.
Any ideas? Does that mean that a method is private or something?
Thanks!
“out of scope” is a general error: sometimes it means that the variable is not initialized or that the variable was released.
It will if the variable was created in a separate thread without being retained.
How do you initialize the article object and where?
Try to retain the article object before calling showArticle method and/or before this line
[aCategory setText:[[self article] category]];.