Skip to content

Commit

Permalink
add onlySwipeButtons property. If true don't swipe the table cell, ju…
Browse files Browse the repository at this point in the history
…st the buttons issue MortimerGoro#106
  • Loading branch information
MortimerGoro committed Jul 12, 2015
1 parent 61f2425 commit 71c9160
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions MGSwipeTableCell/MGSwipeTableCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ typedef NS_ENUM(NSInteger, MGSwipeExpansionLayout) {
/** Property to read or change swipe animation durations. Default value 0.3 */
@property (nonatomic, assign) CGFloat animationDuration;

/** If true the table cell is not swiped, just the buttons **/
@property (nonatomic, assign) BOOL onlySwipeButtons;

@end


Expand Down
4 changes: 3 additions & 1 deletion MGSwipeTableCell/MGSwipeTableCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,9 @@ - (void)setSwipeOffset:(CGFloat) newOffset;
_targetOffset = offset > activeButtons.bounds.size.width * swipeThreshold ? activeButtons.bounds.size.width * sign : 0;
}

_swipeView.transform = CGAffineTransformMakeTranslation(newOffset, 0);
BOOL onlyButtons = sign < 0 ? _rightSwipeSettings.onlySwipeButtons : _leftSwipeSettings.onlySwipeButtons;
_swipeView.transform = CGAffineTransformMakeTranslation(onlyButtons ? 0 : newOffset, 0);

//animate existing buttons
MGSwipeButtonsView* but[2] = {_leftView, _rightView};
MGSwipeSettings* settings[2] = {_leftSwipeSettings, _rightSwipeSettings};
Expand Down

0 comments on commit 71c9160

Please sign in to comment.