I'm trying to set a custom background for a focused UITableViewCell. By default the cell gets a shadow and the size is slightly increased which is a behavior I completely want to remove and just have a normal background color when focused.
BTW I'm using Swift 2.
Any help will be appreciated.
Finally found the answer!
I had to subclass UITableViewCell and override the didUpdateFocusInContext like the following:
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
if context.nextFocusedView === self
{
self.backgroundColor = UIColor.grayColor()
}
else{
self.backgroundColor = UIColor.clearColor()
}
}