Rick Rick - 8 months ago 56
iOS Question

Need Help Populating Table View With Structure Data

I'm trying to fill a table with data I have in a structure, elements_table, which contains an alpha literal element_name. The following does not give a syntax error, but a warning of an incompatible pointer type. I've never worked with a structure in a table view before. Anyone have any ideas for me? Thanks.

cell.textLabel.text = elements_table[0].element_name;

Answer Source

Try cell.textLabel.text = [NSString stringWithCString:elements_table[0].element_name encoding:NSUnicodeStringEncoding] Since you said element_name is an alpha literal, I'm assuming its a string.