step by step I am advancing creating my first iOS app. Now I am experiencing a strange behaviour on a table view controller which I am not able to solve and I have been searchin
The first issue with code I noticed is you must add you code after
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
not before it. It will guarantee that your view is, at least, loaded.
Second, make from all your string literals const string like this and use it everywhere
static NSString * const kUrgentState = @"Urgent";
And one more common hint: add NSLog(...); or test the value of variable in debug to localise the problem, cause right now it's really to much code, but not still not enough to find a problem. Find the moment when values of variable goes wrong and then fix your question
Your problem appears to be in the configureCell:
method. You are not taking cell reuse into account. The cell you are configuring could have need used before and could have had an urgent status previously.
Your code only deals with the situation where the cell is urgent, in which case it adds a subview. There are two problems with this approach:
else
after the if
). This would hide the urgent icon.