0

I have three pictures, A.png, B.png and C.png, which I would like to show it on my tableview accessory area. I have record the category data A, B and C in my Lita database. I wanted to show different pictures for different categories. So I wrote the below code in the cellforrowatindexpath section.

    if (category.table = @"A"){
    accessoryView = A.png
    }else if (category.table = @"B"){
    accessoryView = B.png
    }else{
    accessoryView = C.png}

However, all the picture that shows on accessoryView is A.png. What did I do wrong? How could I fix this to show the pictures' properly.

I will be really appreciate if anyone can help me.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
kenken
  • 25
  • 7
  • 1
    On second thought, it is not a duplicate: Your code *assigns* a new value with `=`. – Martin R Nov 15 '13 at 08:59
  • Thank you very much for the quick help! I had the same problem as the question you have indicated for me. I really appreciate your help. – kenken Nov 15 '13 at 09:02

1 Answers1

1

Did you copy/paste this code fragment ? Cause string comparison are made this way in objective-C :

if ([category.table isEqualToString:@"A"])
{
  // do something
}

Other question : what class is your accessoryView ?

shinyuX
  • 1,519
  • 1
  • 9
  • 20
  • 1
    Thank you very much for the quick reply. I have fixed my code, and it worked. Thank you very much for your help. – kenken Nov 15 '13 at 09:01