I have an interesting problem.
I am loading a UITableView asynchronously. I am trying to get the count:
prefs = [NSUserDefaults standardUserDefaults];
NSInteger dmCount = [prefs integerForKey:@"dmCount"];
NSLog(@"items count %d", [self.items count]);
if (abs([self.items count] - dmCount) > 0) {
[prefs setInteger:abs([self.items count] - dmCount)forKey:@"dmCount"];
}
NSLog(@"%d MESSAGES",abs([self.items count] - dmCount));
However, [self.items count] returns 0 when this code is executed, and then returns 4 (the actual value). I am guessing at the time of table creation my data source is 0, and once it has loaded it becomes 4. How can I make sure I get the correct count?