From aac83200586400b9be3cc1774391eefd4896f74b Mon Sep 17 00:00:00 2001 From: Charles Magahern Date: Mon, 18 Jan 2016 19:29:08 -0800 Subject: [PATCH] Fix bug where switch cells don't allow interaction during animation --- XIONControlPanel/Controllers/SwitchesViewController.swift | 3 ++- XIONControlPanel/Views/WemoCellView.swift | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/XIONControlPanel/Controllers/SwitchesViewController.swift b/XIONControlPanel/Controllers/SwitchesViewController.swift index b16224e..9b83e41 100644 --- a/XIONControlPanel/Controllers/SwitchesViewController.swift +++ b/XIONControlPanel/Controllers/SwitchesViewController.swift @@ -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) diff --git a/XIONControlPanel/Views/WemoCellView.swift b/XIONControlPanel/Views/WemoCellView.swift index 89b7eef..a0cd377 100644 --- a/XIONControlPanel/Views/WemoCellView.swift +++ b/XIONControlPanel/Views/WemoCellView.swift @@ -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) } } }