MGSwipeTableCell icon indicating copy to clipboard operation
MGSwipeTableCell copied to clipboard

Make portion of cell swipeable

Open mattgabor opened this issue 8 years ago • 1 comments

Is there a way to make a portion of the cell swipeable, and the rest static?

mattgabor avatar Aug 03 '16 22:08 mattgabor

You can do something like this:

  1. Add your static view to cell.swipeContentView instead of cell.contentView
  2. Override swipeOffset in your MGSwipeTableCell subclass and layout the static view based on the offset value to simulate a fixed position. Code example (not tested):
- (void)setSwipeOffset:(CGFloat) newOffset
{
    [super setSwipeOffset:newOffset];
    //layout the static view to simulate a fixed position
    UIView * staticView; //Use your view here
    CGRect frame = staticView.frame;
    frame.origin.x = -newOffset;
    staticView.frame = frame;
}

MortimerGoro avatar Aug 24 '16 15:08 MortimerGoro