diff --git a/Example/SBGestureTableView-Swift/Base.lproj/Main.storyboard b/Example/SBGestureTableView-Swift/Base.lproj/Main.storyboard index 3b54cf6..3bd91b9 100644 --- a/Example/SBGestureTableView-Swift/Base.lproj/Main.storyboard +++ b/Example/SBGestureTableView-Swift/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -36,9 +37,10 @@ - + + @@ -85,7 +87,7 @@ - + diff --git a/Example/SBGestureTableView-Swift/MasterViewController.swift b/Example/SBGestureTableView-Swift/MasterViewController.swift index 3419124..689dc3a 100644 --- a/Example/SBGestureTableView-Swift/MasterViewController.swift +++ b/Example/SBGestureTableView-Swift/MasterViewController.swift @@ -8,9 +8,9 @@ import UIKit -class MasterViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { +class MasterViewController: UIViewController { - var objects = NSMutableArray() + var objects = [(value: String, leftActionsEnabled: Bool)]() @IBOutlet weak var tableView: SBGestureTableView! @@ -18,31 +18,37 @@ class MasterViewController: UIViewController, UITableViewDataSource, UITableView let closeIcon = FAKIonIcons.ios7CloseIconWithSize(30) let composeIcon = FAKIonIcons.ios7ComposeIconWithSize(30) let clockIcon = FAKIonIcons.ios7ClockIconWithSize(30) + let helpIcon = FAKIonIcons.ios7HelpIconWithSize(30) + let greenColor = UIColor(red: 85.0/255, green: 213.0/255, blue: 80.0/255, alpha: 1) let redColor = UIColor(red: 213.0/255, green: 70.0/255, blue: 70.0/255, alpha: 1) let yellowColor = UIColor(red: 236.0/255, green: 223.0/255, blue: 60.0/255, alpha: 1) + let orangeColor = UIColor(red: 240.0/255, green: 129.0/255, blue: 85.0/255, alpha: 1) let brownColor = UIColor(red: 182.0/255, green: 127.0/255, blue: 78.0/255, alpha: 1) var removeCellBlock: ((SBGestureTableView, SBGestureTableViewCell) -> Void)! - override func awakeFromNib() { - super.awakeFromNib() - } - + + // MARK: - View Life Cycle + override func viewDidLoad() { super.viewDidLoad() - let addButton = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "insertNewObject:") + let addButton = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: #selector(MasterViewController.insertNewObject(_:))) navigationItem.rightBarButtonItem = addButton setupIcons() tableView.didMoveCellFromIndexPathToIndexPathBlock = {(fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) -> Void in - self.objects.exchangeObjectAtIndex(toIndexPath.row, withObjectAtIndex: fromIndexPath.row) + + swap(&self.objects[toIndexPath.row], &self.objects[fromIndexPath.row]) } + + removeCellBlock = {(tableView: SBGestureTableView, cell: SBGestureTableViewCell) -> Void in - let indexPath = tableView.indexPathForCell(cell) - self.objects.removeObjectAtIndex(indexPath!.row) - tableView.removeCell(cell, duration: 0.3, completion: nil) + if let indexPath = tableView.indexPathForCell(cell) { + self.objects.removeAtIndex(indexPath.row) + tableView.removeCell(cell, duration: 0.3, completion: nil) + } } } @@ -56,49 +62,144 @@ class MasterViewController: UIViewController, UITableViewDataSource, UITableView closeIcon.addAttribute(NSForegroundColorAttributeName, value: UIColor.whiteColor()) composeIcon.addAttribute(NSForegroundColorAttributeName, value: UIColor.whiteColor()) clockIcon.addAttribute(NSForegroundColorAttributeName, value: UIColor.whiteColor()) + helpIcon.addAttribute(NSForegroundColorAttributeName, value: UIColor.whiteColor()) } - func insertNewObject(sender: AnyObject) { - objects.insertObject(NSDate(), atIndex: 0) - let indexPath = NSIndexPath(forRow: 0, inSection: 0) - tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic) - } // MARK: - Segues override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showDetail" { if let indexPath = tableView.indexPathForSelectedRow { - let object = objects[indexPath.row] as! NSDate - (segue.destinationViewController as! DetailViewController).detailItem = object + let object = objects[indexPath.row] + (segue.destinationViewController as! DetailViewController).detailItem = object.value tableView.deselectRowAtIndexPath(indexPath, animated: true) } } } - // MARK: - Table View - - func numberOfSectionsInTableView(tableView: UITableView) -> Int { - return 1 - } +} +// MARK: - Table View +extension MasterViewController: UITableViewDelegate, UITableViewDataSource { + + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return objects.count } - + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let size = CGSizeMake(30, 30) - let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! SBGestureTableViewCell - - cell.firstLeftAction = SBGestureTableViewCellAction(icon: checkIcon.imageWithSize(size), color: greenColor, fraction: 0.3, didTriggerBlock: removeCellBlock) - cell.secondLeftAction = SBGestureTableViewCellAction(icon: closeIcon.imageWithSize(size), color: redColor, fraction: 0.6, didTriggerBlock: removeCellBlock) - cell.firstRightAction = SBGestureTableViewCellAction(icon: composeIcon.imageWithSize(size), color: yellowColor, fraction: 0.3, didTriggerBlock: removeCellBlock) - cell.secondRightAction = SBGestureTableViewCellAction(icon: clockIcon.imageWithSize(size), color: brownColor, fraction: 0.6, didTriggerBlock: removeCellBlock) - let object = objects[indexPath.row] as! NSDate - cell.textLabel!.text = object.description + let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! SBGestureTableViewCell + return cell } + func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { + let cell = cell as! SBGestureTableViewCell + setupCell(cell, atIndexPath: indexPath) + } + + } + + +// MARK: - Helpers +extension MasterViewController { + + func insertNewObject(sender: AnyObject) { + let indexPath = NSIndexPath(forRow: objects.endIndex, inSection: 0) + objects.append((value: NSDate().description, leftActionsEnabled: random()%2 == 0)) + + tableView.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic) + + } + + // Alerts + + func showTime(editable editable: Bool = false) -> ((SBGestureTableView, SBGestureTableViewCell) -> Void) { + + return { (tableView, cell) in + guard let indexPath = tableView.indexPathForCell(cell) else { + return + } + + let alert = UIAlertController(title: "Showing the selected item", message: editable ? "Change the date" : "The Date is: \(self.objects[indexPath.row].value)", preferredStyle: .Alert) + + + cell.closeSlide() + + if editable { + alert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)) + alert.addAction(UIAlertAction(title: "Save", style: .Default, handler: { action in + + if let textFields = alert.textFields, + let textField = textFields.first, + let text = textField.text where editable == true { + + self.objects[indexPath.row].value = text + } + + self.setupCell(cell, atIndexPath: indexPath) + })) + + alert.addTextFieldWithConfigurationHandler({ (textField) in + textField.text = self.objects[indexPath.row].value + }) + + } else { + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil)) + } + + self.presentViewController(alert, animated: true, completion: nil) + } + } + + func setupCell(cell: SBGestureTableViewCell, atIndexPath indexPath: NSIndexPath) { + + let size = CGSizeMake(30, 30) + let object = objects[indexPath.row] + + // + // Left Actions + // + + if object.leftActionsEnabled { + let acceptAction = SBGestureTableViewCellAction(icon: checkIcon.imageWithSize(size), color: greenColor, fraction: 0.3) { (tableView, cell) in + self.objects[indexPath.row].leftActionsEnabled = false + cell.closeSlide() + } + + cell.leftActions = [acceptAction, SBGestureTableViewCellAction(icon: closeIcon.imageWithSize(size), color: redColor, fraction: 0.6, didTriggerBlock: removeCellBlock)] + cell.textLabel?.textColor = UIColor.blackColor() + + } else { + cell.leftActions = [] + cell.textLabel?.textColor = redColor + } + + + // + // Right Actions + // + + let calendarAction = SBGestureTableViewCellAction(icon: composeIcon.imageWithSize(size), color: yellowColor, fraction: 0.2, didTriggerBlock: showTime(editable: true)) + let clockAction = SBGestureTableViewCellAction(icon: clockIcon.imageWithSize(size), color: orangeColor, fraction: 0.3, didTriggerBlock: showTime()) + let helpAction = SBGestureTableViewCellAction(icon: helpIcon.imageWithSize(size), color: brownColor, fraction: 0.4) { (tableView, cell) in + let alert = UIAlertController(title: "This is a quick demo", message: nil, preferredStyle: .Alert) + alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil)) + cell.closeSlide() + self.presentViewController(alert, animated: true, completion: nil) + } + + cell.rightActions = [calendarAction, clockAction, helpAction] + + // + // Text + // + + cell.textLabel!.text = object.value + + } +} diff --git a/SBGestureTableView/SBGestureTableView.swift b/SBGestureTableView/SBGestureTableView.swift index 2c2575b..392a3cf 100644 --- a/SBGestureTableView/SBGestureTableView.swift +++ b/SBGestureTableView/SBGestureTableView.swift @@ -9,12 +9,12 @@ import UIKit class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { - + var draggingViewOpacity = 1.0 var isEnabled = true var edgeSlidingMargin = 0.0 var edgeAutoscrollMargin = 0.0 - + var cellReplacingBlock: ((SBGestureTableView, SBGestureTableViewCell) -> (Void))? var didMoveCellFromIndexPathToIndexPathBlock: ((NSIndexPath, NSIndexPath) -> (Void))? @@ -45,10 +45,10 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { private var savedObject: NSObject? private var scrollDisplayLink : CADisplayLink? private var longPress: UILongPressGestureRecognizer = UILongPressGestureRecognizer() - + func initialize() { - longPress.addTarget(self, action: "longPress:") + longPress.addTarget(self, action: #selector(self.longPress(_:))) longPress.delegate = self addGestureRecognizer(longPress) cellReplacingBlock = {(tableView: SBGestureTableView, cell: SBGestureTableViewCell) -> Void in @@ -60,7 +60,7 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { super.init(frame: frame, style: style) initialize() } - + required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) initialize() @@ -105,7 +105,7 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { let indexPath = indexPathForRowAtPoint(location) let sections = numberOfSections var rows = 0 - for var i = 0; i < sections; i++ { + for i in 0 ..< sections { rows += numberOfRowsInSection(i) } @@ -113,8 +113,8 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { // or the dataSource tableView:canMoveRowAtIndexPath: doesn't allow moving the row if (rows == 0 || (gesture.state == UIGestureRecognizerState.Began && indexPath == nil) || (gesture.state == UIGestureRecognizerState.Ended && currentLocationIndexPath == nil)) { - cancelGesture() - return + cancelGesture() + return } // started @@ -157,10 +157,10 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { initialIndexPath = indexPath; // enable scrolling for cell - scrollDisplayLink = CADisplayLink(target: self, selector: "scrollTableWithCell:") + scrollDisplayLink = CADisplayLink(target: self, selector: #selector(SBGestureTableView.scrollTableWithCell(_:))) scrollDisplayLink?.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSDefaultRunLoopMode) } - // dragging + // dragging else if gesture.state == UIGestureRecognizerState.Changed { var rect = bounds; // adjust rect for content inset as we will use it below for calculating scroll zones @@ -174,7 +174,7 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { if location.y >= bottomScrollBeginning { scrollRate = Double((location.y - bottomScrollBeginning) / scrollZoneHeight); } - // we're in the top zone + // we're in the top zone else if (location.y <= topScrollBeginning) { scrollRate = Double((location.y - topScrollBeginning) / scrollZoneHeight); } @@ -182,8 +182,8 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { scrollRate = 0; } } - - // dropped + + // dropped else if gesture.state == UIGestureRecognizerState.Ended { isEnabled = true let indexPath: NSIndexPath = currentLocationIndexPath! @@ -197,13 +197,13 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { let rect = self.rectForRowAtIndexPath(indexPath) self.draggingView!.transform = CGAffineTransformIdentity self.draggingView!.frame = CGRectOffset(self.draggingView!.bounds, rect.origin.x, rect.origin.y) - }, completion: {(Bool) -> Void in - self.draggingView!.removeFromSuperview() - cell.hidden = false - let visibleRows = self.indexPathsForVisibleRows!.filter { $0 != indexPath } - self.reloadRowsAtIndexPaths(visibleRows, withRowAnimation: UITableViewRowAnimation.None) - self.currentLocationIndexPath = nil - self.draggingView = nil + }, completion: {(Bool) -> Void in + self.draggingView!.removeFromSuperview() + cell.hidden = false + let visibleRows = self.indexPathsForVisibleRows!.filter { $0 != indexPath } + self.reloadRowsAtIndexPaths(visibleRows, withRowAnimation: UITableViewRowAnimation.None) + self.currentLocationIndexPath = nil + self.draggingView = nil }) } } @@ -219,11 +219,11 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { let newHeight = rectForRowAtIndexPath(indexPath).size.height if indexPath != currentLocationIndexPath && gesture.locationInView(cellForRowAtIndexPath(indexPath)).y > newHeight - oldHeight { - beginUpdates() - moveRowAtIndexPath(currentLocationIndexPath!, toIndexPath: indexPath) - didMoveCellFromIndexPathToIndexPathBlock!(currentLocationIndexPath!, indexPath) - currentLocationIndexPath = indexPath - endUpdates() + beginUpdates() + moveRowAtIndexPath(currentLocationIndexPath!, toIndexPath: indexPath) + didMoveCellFromIndexPathToIndexPathBlock!(currentLocationIndexPath!, indexPath) + currentLocationIndexPath = indexPath + endUpdates() } } } @@ -251,14 +251,15 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { let cell = cellForRowAtIndexPath(indexPath)! as! SBGestureTableViewCell; removeCell(cell, indexPath: indexPath, duration: duration, completion: completion) } - + func removeCell(cell: SBGestureTableViewCell, duration: NSTimeInterval, completion:(() -> Void)?) { let indexPath = indexPathForCell(cell)! removeCell(cell, indexPath: indexPath, duration: duration, completion: completion) } - - private func removeCell(cell: SBGestureTableViewCell, indexPath: NSIndexPath, var duration: NSTimeInterval, completion: (()-> Void)?) { + + private func removeCell(cell: SBGestureTableViewCell, indexPath: NSIndexPath, duration: NSTimeInterval, completion: (() -> Void)?) { + var duration = duration if (duration == 0) { duration = 0.3; } @@ -285,7 +286,10 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { } } - func replaceCell(cell: SBGestureTableViewCell, var duration: NSTimeInterval, var bounce: (CGFloat), completion:(() -> Void)?) { + func replaceCell(cell: SBGestureTableViewCell, duration: NSTimeInterval, bounce: (CGFloat), completion:( () -> Void)?) { + var bounce = bounce + var duration = duration + if duration == 0 { duration = 0.25 } @@ -330,7 +334,7 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { override func willMoveToSuperview(newSuperview: UIView?) { showOrHideBackgroundViewAnimatedly(false) } - + func showOrHideBackgroundViewAnimatedly(animatedly: Bool) { UIView.animateWithDuration(animatedly ? 0.3 : 0) { self.backgroundView?.alpha = self.isEmpty ? 1 : 0 @@ -342,21 +346,21 @@ class SBGestureTableView: UITableView, UIGestureRecognizerDelegate { let numberOfSections = dataSource.numberOfSectionsInTableView!(self) return (0.. 0 }.isEmpty + }.filter { $0 > 0 }.isEmpty } return true } - + override func insertRowsAtIndexPaths(indexPaths: [NSIndexPath], withRowAnimation animation: UITableViewRowAnimation) { super.insertRowsAtIndexPaths(indexPaths, withRowAnimation: animation) showOrHideBackgroundViewAnimatedly(true) } - + override func insertSections(sections: NSIndexSet, withRowAnimation animation: UITableViewRowAnimation) { super.insertSections(sections, withRowAnimation: animation) showOrHideBackgroundViewAnimatedly(true) } - + override func deleteRowsAtIndexPaths(indexPaths: [NSIndexPath], withRowAnimation animation: UITableViewRowAnimation) { super.deleteRowsAtIndexPaths(indexPaths, withRowAnimation: animation) showOrHideBackgroundViewAnimatedly(true) diff --git a/SBGestureTableView/SBGestureTableViewCell.swift b/SBGestureTableView/SBGestureTableViewCell.swift index 2df1ce9..7d23844 100644 --- a/SBGestureTableView/SBGestureTableViewCell.swift +++ b/SBGestureTableView/SBGestureTableViewCell.swift @@ -10,43 +10,41 @@ import UIKit class SBGestureTableViewCell: UITableViewCell { - + var actionIconsFollowSliding = true var actionIconsMargin: CGFloat = 20.0 var actionNormalColor = UIColor(white: 0.85, alpha: 1) - + var leftSideView = SBGestureTableViewCellSideView() var rightSideView = SBGestureTableViewCellSideView() - var firstLeftAction: SBGestureTableViewCellAction? { - didSet { - if (firstLeftAction?.fraction == 0) { - firstLeftAction?.fraction = 0.3 - } - } - } - var secondLeftAction: SBGestureTableViewCellAction? { - didSet { - if (secondLeftAction?.fraction == 0) { - secondLeftAction?.fraction = 0.7 - } - } - } - var firstRightAction: SBGestureTableViewCellAction? { + private var leftActionFractions = [Double]() + var leftActions: [SBGestureTableViewCellAction] = [SBGestureTableViewCellAction]() { didSet { - if (firstRightAction?.fraction == 0) { - firstRightAction?.fraction = 0.3 + leftActions = leftActions.sort { (a1: SBGestureTableViewCellAction, a2: SBGestureTableViewCellAction) -> Bool in + return a1.fraction < a2.fraction } + + leftActionFractions = leftActions.map({ (action) -> Double in + return Double(action.fraction) + }) + [1.0] } } - var secondRightAction: SBGestureTableViewCellAction? { + + private var rightActionFractions = [Double]() + var rightActions: [SBGestureTableViewCellAction] = [SBGestureTableViewCellAction]() { didSet { - if (secondRightAction?.fraction == 0) { - secondRightAction?.fraction = 0.7 + rightActions = rightActions.sort { (a1: SBGestureTableViewCellAction, a2: SBGestureTableViewCellAction) -> Bool in + return a1.fraction < a2.fraction } + + rightActionFractions = rightActions.map({ (action) -> Double in + return Double(action.fraction) + }) + [1.0] } } + var currentAction: SBGestureTableViewCellAction? override var center: CGPoint { get { @@ -70,7 +68,7 @@ class SBGestureTableViewCell: UITableViewCell { private let panGestureRecognizer = UIPanGestureRecognizer() func setup() { - panGestureRecognizer.addTarget(self, action: "slideCell:") + panGestureRecognizer.addTarget(self, action: #selector(self.slideCell(_:))) panGestureRecognizer.delegate = self addGestureRecognizer(panGestureRecognizer) } @@ -112,7 +110,7 @@ class SBGestureTableViewCell: UITableViewCell { && horizontalLocation > CGFloat(gestureTableView.edgeSlidingMargin) && horizontalLocation < frame.size.width - CGFloat(gestureTableView.edgeSlidingMargin) && gestureTableView.isEnabled { - return true; + return true; } } else if gestureRecognizer.isKindOfClass(UILongPressGestureRecognizer) { if gestureTableView.didMoveCellFromIndexPathToIndexPathBlock == nil { @@ -124,19 +122,20 @@ class SBGestureTableViewCell: UITableViewCell { func actionForCurrentPosition() -> SBGestureTableViewCellAction? { let fraction = fabs(frame.origin.x/frame.size.width) - if frame.origin.x > 0 { - if secondLeftAction != nil && fraction > secondLeftAction!.fraction { - return secondLeftAction! - } else if firstLeftAction != nil && fraction > firstLeftAction!.fraction { - return firstLeftAction! - } - } else if frame.origin.x < 0 { - if secondRightAction != nil && fraction > secondRightAction!.fraction { - return secondRightAction! - } else if firstRightAction != nil && fraction > firstRightAction!.fraction { - return firstRightAction! + + let isLeftSlide = frame.origin.x > 0 + let actionsMap = isLeftSlide ? leftActionFractions : rightActionFractions + let actions = isLeftSlide ? leftActions : rightActions + + for (index, actionFraction) in actionsMap.enumerate() { + if actionFraction > Double(fraction) { + if index == 0 { + return nil + } + return actions[index-1] } } + return nil } @@ -153,10 +152,10 @@ class SBGestureTableViewCell: UITableViewCell { } else { if frame.origin.x > 0 { leftSideView.backgroundColor = actionNormalColor - leftSideView.iconImageView.image = firstLeftAction!.icon + leftSideView.iconImageView.image = leftActions.first?.icon } else if frame.origin.x < 0 { rightSideView.backgroundColor = actionNormalColor - rightSideView.iconImageView.image = firstRightAction!.icon + rightSideView.iconImageView.image = rightActions.first?.icon } } if let image = leftSideView.iconImageView.image { @@ -173,22 +172,22 @@ class SBGestureTableViewCell: UITableViewCell { } func hasAnyLeftAction() -> Bool { - return firstLeftAction != nil || secondLeftAction != nil + return leftActions.count > 0 } - + func hasAnyRightAction() -> Bool { - return firstRightAction != nil || secondRightAction != nil + return rightActions.count > 0 } - + func setupSideViews() { leftSideView.iconImageView.contentMode = actionIconsFollowSliding ? UIViewContentMode.Right : UIViewContentMode.Left rightSideView.iconImageView.contentMode = actionIconsFollowSliding ? UIViewContentMode.Left : UIViewContentMode.Right superview?.insertSubview(leftSideView, atIndex: 0) superview?.insertSubview(rightSideView, atIndex: 0) } - + func slideCell(panGestureRecognizer: UIPanGestureRecognizer) { - if !hasAnyLeftAction() || !hasAnyRightAction() { + if !hasAnyLeftAction() && !hasAnyRightAction() { return } var horizontalTranslation = panGestureRecognizer.translationInView(self).x @@ -197,7 +196,7 @@ class SBGestureTableViewCell: UITableViewCell { } else if panGestureRecognizer.state == UIGestureRecognizerState.Changed { if (!hasAnyLeftAction() && frame.size.width/2 + horizontalTranslation > frame.size.width/2) || (!hasAnyRightAction() && frame.size.width/2 + horizontalTranslation < frame.size.width/2) { - horizontalTranslation = 0 + horizontalTranslation = 0 } performChanges() center = CGPointMake(frame.size.width/2 + horizontalTranslation, center.y) @@ -211,6 +210,12 @@ class SBGestureTableViewCell: UITableViewCell { } } + func closeSlide() { + leftSideView.iconImageView.alpha = 0.0 + rightSideView.iconImageView.alpha = 0.0 + gestureTableView.reloadData() + } + func updateSideViews() { leftSideView.frame = CGRectMake(0, frame.origin.y, frame.origin.x, frame.size.height) if let image = leftSideView.iconImageView.image {