Problem with selected menu item background
Hi,
When I select one of the first two menu item (index: 0 or 1) its background doesn't change to the selectedBackgrounView. When I tap on it the selected background blink for a sec but is disappears. If I select the same item again then it changes correctly but obviously the content view not change again. Every other menu item after these works perfectly. When a tap on them closing the menu and the item stay selected.
I set the background like this in the cellForRowAtIndexPath function when I create my menuTableViewController: let selectedBackgroundView = UIView(frame: CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height)) selectedBackgroundView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.2) cell.selectedBackgroundView = selectedBackgroundView
If you have any idea how to fix this pleas let me know. It's really annoying
Hi,
Check the didSelectRowAtIndexPath function, probably you added some code causing this issue.
Hi, the problem has solved, but I don't know why.
At the very first cell indexPath.row == 0 I use a picture, I loaded it like this
.... if isOnline{
imageFromServer(cell)
} .....
After I've changed this code to this, the background selection works fine: ... if let image = UIImage(named: "menu-icon-user"){ cell.iconImageView.image = image } ...
The really interesting thing is that this solved it on the second cell too, but it shouldn't have any connection to it...