ENSwiftSideMenu icon indicating copy to clipboard operation
ENSwiftSideMenu copied to clipboard

Problem with selected menu item background

Open pappzsolt100 opened this issue 10 years ago • 2 comments

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

pappzsolt100 avatar Aug 01 '15 19:08 pappzsolt100

Hi, Check the didSelectRowAtIndexPath function, probably you added some code causing this issue.

evnaz avatar Aug 10 '15 16:08 evnaz

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...

pappzsolt100 avatar Aug 12 '15 09:08 pappzsolt100