I\'ve a UITableView
with custom UILabel
for title and one another to subtitle, in order to align the text to right.
My data come from web s
In your tableView:willDisplayCell:forRowAtIndexPath:
,
check this line,
cell = [Netroads willDisplayFlatDesignCell:cell];
something wrong with this method, [Netroads willDisplayFlatDesignCell];
You are trying to get a length
from a NSDictionary
instead of NSArray
. If you are loading data from a JSON webservice, probably you are parsing NSDictionary
as an NSArray
. Fix that method, then it won't crash.
You are setting the cell's text
property to a dictionary:
cell.textLabel.text = dict[@"Title"];
From your log of dict
:
Title = {
};
and:
detailTextLabel.text = dict[@"Text"];
From your log of dict
:
Text = {
};
It's not clear exactly what values should be used from dict
, but it should not be those dictionaries.
According to your log, you're try to access NSDictionary
object as NSString
. That's why it leads to above error.
Problem should be here..
NSString *imageUrl = dict[@"imageUrl"];
If it's dictionary, it should be crash in this line..
if (imageUrl.length > 0)
Reason: NSDictionary doesn't have lengh method but NSString has
Change this line
if (imageUrl.length > 0)
{
To
if ([imageUrl isKindOfClass:[NSString class]] && imageUrl.length > 0)
{