BORSwipableCell
A custom UITableViewCell and 'UIView' that supports cell dragging gesture to reveal a custom views or buttons in left and right parts of cell.
Usage
To run the example project; clone the repo, and run pod install from the Project directory first.
- If you're using Interface Builder, define the
Custom Classof the cell asBORSwipableCell. If you're going by code, registerBORSwipableCellwith yourUITableView. - Implement the
tableView:cellForRowAtIndexPathmethod and configure the cell as desired:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
BORSwipableCell *cell = [tableView dequeueReusableCellWithIdentifier:swipableCellIdentifier forIndexPath:indexPath];
UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 90, 90)];
leftButton.backgroundColor = [UIColor redColor];
[leftButton setTitle:@"Decline" forState:UIControlStateNormal];
UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 120, 90)];
rightButton.backgroundColor = [UIColor greenColor];
[rightButton setTitle:@"Accept" forState:UIControlStateNormal];
[cell setButton:leftButton asHiddenViewAtPosition:BORSwipableViewHiddenViewPositionLeft blockAction:^(id <BORSwipableView> buttonOwnerView, UIButton *button) {
NSLog(@"Declined");
}];
[cell setButton:rightButton asHiddenViewAtPosition:BORSwipableViewHiddenViewPositionRight blockAction:^(id <BORSwipableView> buttonOwnerView, UIButton *button) {
NSLog(@"Accepted");
}];
cell.swipableDirections = BORSwipableViewSwipeDirectionBoth;
return cell;
}Requirements
Installation
BORSwipableCell is available through CocoaPods, to install it simply add the following line to your Podfile:
pod "BORSwipableCell"
Author
BohdanOrlov, Bohdan.Orlov@gmail.com
License
BORSwipableCell is available under the MIT license. See the LICENSE file for more info.


