Closed beweinreich closed 10 years ago
I try to figure it out at the moment...
let cell: NoMatchCell = tableView.dequeueReusableCellWithIdentifier("NoMatchCell", forIndexPath: indexPath) as NoMatchCell
var test: MCSwipeCompletionBlock?
var testView: UIView = UIView(frame: CGRectMake(100, 100, 100, 100))
cell.setSwipeGestureWithView(testView, color: UIColor.blueColor(), mode: MCSwipeTableViewCellMode.Switch, state: MCSwipeTableViewCellState.State1, completionBlock: test)
return cell
Is my very very very first test which works. NoMatchCell.swift: class NoMatchCell : MCSwipeTableViewCell
I don't know if you can do something with this.. but I don't need buttons I, just want to display some extra info :)
Cool thanks! I ended up writing it with this code, and it works pretty well!
var cell = tableView.dequeueReusableCellWithIdentifier("userCell") as MCSwipeTableViewCell!
cell.setSwipeGestureWithView(crossView, color: UIColor.colorFromRGB(RED), mode: MCSwipeTableViewCellMode.Switch, state:MCSwipeTableViewCellState.State1, completionBlock: { cell, state, mode in
self.changeCoffeeScore(coffeeScore!, newValue: NSNumber.numberWithInt(-1))
return ()
});
@bluesm I haven't tested on a iOS 8 device yet. However, I am using Xcode 6 Beta 3, and the adding / deleting of rows with a fetchedresultscontroller works well. Not sure why yours is acting oddly. Perhaps you are deleting the row at index path, but the datasource still contains the object?
@beweinreich
"EDIT: Don't read this: It was my mistake, I haven't know we need to delete cell ourself"
I'll remove it since it spreads confusion. You can aloso remove your comment :)
if anyone else is having problems with using MCSwipeTableViewCells with Swift, a made a demo here https://github.com/ethanneff/iOS-Swift-Swipe-Table-View-Cells
Anyone have an example using this code with Swift? I've been attempting to use it, but it's been throwing some errors with setSwipeGestureWithView.