I am using the StoryBoard feature for my iPhone project. In the storyboard, I have a view controller with a table view using prototypes. Inside the prototype cell, I have a UIButton (rounded rectangle) connected to the UIButton class of the subclass. Tableview gets its data from the array, and the data is printed in cellForRowAtIndexPath.
Inside cellForRowAtIndexPath, I conditionally change the appearance of the cell. This is when I start getting problems. I can successfully change the button text. However, if I try to change the button image using:
[cell.myButton setImage:[UIImage imageNamed:@"mynewimage.png"] forState:UIControlStateNormal];
the image changes, but the text disappears.
If I try to change the button text color using:
[cell.myButton setTitleColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:.77] forState:UIControlStateNormal]
Nothing happens. The color remains the same (unless I try to change the image, in which case it will completely disappear).
I feel like I'm doing something fundamentally wrong here - do you have any suggestions?
source share