Fix bug where switch cells don't allow interaction during animation

This commit is contained in:
Charles Magahern
2016-01-18 19:29:08 -08:00
parent bb59974376
commit aac8320058
2 changed files with 5 additions and 3 deletions

View File

@@ -199,8 +199,9 @@ class SwitchesViewController: UIViewController,
for var i = ActionCell.count; i < collectionView.numberOfItemsInSection(indexPath.section); ++i {
let cell = collectionView.cellForItemAtIndexPath(NSIndexPath(forItem: i, inSection: indexPath.section)) as! WemoDeviceCellView
let animOptions = UIViewAnimationOptions([.AllowUserInteraction])
UIView.animateWithDuration(0.3, delay: currentDelay, options: UIViewAnimationOptions(), animations: { () -> Void in
UIView.animateWithDuration(0.3, delay: currentDelay, options: animOptions, animations: {
cell.toggled = (tappedActionCell == .AllOn)
}, completion: nil)

View File

@@ -45,9 +45,10 @@ public class WemoCellView: UICollectionViewCell {
if (self.highlighted) {
_selectionOverlayView.backgroundColor = UIColor(white: 0.8, alpha: 1.0)
} else {
UIView.animateWithDuration(1.0, animations: { () -> Void in
let animOptions = UIViewAnimationOptions([.AllowUserInteraction])
UIView.animateWithDuration(1.0, delay: 0.0, options: animOptions, animations: {
self._selectionOverlayView.backgroundColor = UIColor.clearColor()
})
}, completion: nil)
}
}
}