When I select a cell using the cell selection button , the design of the cell changes.
There is a blue line in the bottom (may be due to selection highlighting)
and the round corner changes to light blue.
Please suggest ways to solve this issue. I don't want these two effects.
Try something like this:
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
Related
I have a custom UITableViewCell class. I am toggling between accessoryTypes of UITableViewCellAccessoryCheckmark and UITableViewCellAccessoryNone when didSelectRowAtIndexPath is called. Here's an example of what the cells look like before and after selection:
before...
after....
My problem is this: the circle-colored views on the left hand side flicker when I select the cell. How do I keep the circles from flickering when the table cell is selected? I'm not manually doing any sort of reloading of the cell. Does it have something to do with selection state? Any help would be greatly appreciated; thanks!
I assume that in your cellForRowAtIndexPath method you are doing something like
[cell setImage:[UIImage imageNamed:#"someImage"] forState:UIControlStateNormal];
Try setting an image for UIControlStateHighlighted and see if that helps. Even if its the same image.
Yep, that was the solution. Thanks #aking63 for spiking an idea in me. By just overriding the setSelected method in my custom UITableViewCell class, and populating the indicator view the same way I was on setting up the cell, all things work as needed. No more flicker!
Is anyone else experiencing this problem where if you programmatically set the selected state of a UITableViewCell to YES, it colors the text label black?
[cell setSelected:YES]
I can't seem to figure this out. I would expect it to highlight the cell blue. Manually selecting the cell works as it colors the cell blue while the text is displayed in white.
Any help is appreciated. Thanks in advance!
I was having the same problem and fixed it by moving the cell.selected = YES into tableView:willDisplayCell:forRowAtIndexPath instead.
I think it might be related to the note at the bottom of the UITableViewCell docs about changes to background color requiring use of tableView:willDisplayCell:forRowAtIndexPath (presumably selected sets the background color).
Is there any way to set the accessoryType of the cell to be in the left side?
the code i use:
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
in this condition the accessoryType button is on the right side and i want it in the left side.
I tried also to build a custom cell be in the IB when i chose accessory it put it automatic in the right side also.
No, but you can set the cell's imageView.image property to a UIImage of your choice.
If you re-use Apple's disclosure button images, you might run into issues getting your app accepted, so you might want to create your own disclosure icons.
hi i have a problem with the selection when I select a row in uitableviewcell it selects and turns to blue with out making any animation i mean normally when a row in table is selected it turns into blue and go off immediately like an animation. How to achieve that? Not deslecting a row....it is like highlight the cell and go off when cell is selected by user...Can any one help please....
From the Table View Programming Guide, Responding to Selections:
In your tableView:didSelectRowAtIndexPath: method add the following:
[tableView deselectRowAtIndexPath:indexPath animated:NO];
"Selecting" does the blue-highlight animation, "deselecting" flashes it back to normal color. By adding a deselection as soon as it's selected you get the effect of flashing it with color.
If you want to avoid the whole coloring thing, you can use UITableViewCellSelectionStyleNone as your cell style.
My UITableViewController uses a custom UITableViewCell Subclass.
The subClass (QuoteCell - loaded from NIB) has a few UILabels and a UIImageView on it.
Works fine, however, when I tap on the cell, the cell highlights, but the UILabels on the cell don't reverse colors.
I thought this was stock behavior??
Any help appreciated, Thanks!
btw: There's nothing in the didSelectRowAtIndexPath method yet.
I found the answer, after reading comments from Jasarien and Prakash.
Apparently, in IB, you manually have to select a highlight color to see the behavior.
By default, UILabel color is Black and the highlight color apparently is also Black, which is strange because it has that half black, half white diagonal. I would think the behavior would be different.
Anyway, I changed the color to solid white and got the highlighted behavior I was expecting.
I wonder why you need to show the row selection?
You could do this
cell.selectionStyle = UITableViewCellSelectionStyleNone;
and handle your row selection logic as-is..
You have to write the code to swap the text colour of the label yourself.
The best place for that would probably be in -setHighlighted:animated: