Usando datos de lira, ¿cómo se escribe la rama condicional en el objetivo-c [duplicado]
Frecuentes
Visto 35 veces
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.
1 Respuestas
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 ?
respondido 15 nov., 13:08
Thank you very much for the quick reply. I have fixed my code, and it worked. Thank you very much for your help. - Kenken
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas ios objective-c sqlite or haz tu propia pregunta.
On second thought, it is not a duplicate: Your code asigna a new value with
=
. - Martin RThank 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