Skip to content

Commit

Permalink
Fixed using incorrect swipe overlay frames and snapshotting system ce…
Browse files Browse the repository at this point in the history
…ll separator.
  • Loading branch information
Strebkov Konstantin authored and MortimerGoro committed Jun 17, 2017
1 parent f50bc77 commit ea5b1b1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions MGSwipeTableCell/MGSwipeTableCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ -(void) fetchButtonsIfNeeded
-(void) createSwipeViewIfNeeded
{
if (!_swipeOverlay) {
_swipeOverlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
_swipeOverlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.contentView.bounds.size.height)];
[self fixRegionAndAccesoryViews];
_swipeOverlay.hidden = YES;
_swipeOverlay.backgroundColor = [self backgroundColorForSwipe];
Expand Down Expand Up @@ -754,7 +754,11 @@ - (void) showSwipeOverlayIfNeeded
if (_delegate && [_delegate respondsToSelector:@selector(swipeTableCellWillBeginSwiping:)]) {
[_delegate swipeTableCellWillBeginSwiping:self];
}
_swipeView.image = [self imageFromView:self];

// snapshot cell without separator
CGSize cropSize = CGSizeMake(self.bounds.size.width, self.contentView.bounds.size.height);
_swipeView.image = [self imageFromView:self cropSize:cropSize];

_swipeOverlay.hidden = NO;
if (_swipeContentView)
[_swipeView addSubview:_swipeContentView];
Expand Down Expand Up @@ -901,8 +905,8 @@ -(UIView *) hitTest:(CGPoint)point withEvent:(UIEvent *)event

#pragma mark Some utility methods

- (UIImage *)imageFromView:(UIView *)view {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [[UIScreen mainScreen] scale]);
- (UIImage *)imageFromView:(UIView *)view cropSize:(CGSize)cropSize{
UIGraphicsBeginImageContextWithOptions(cropSize, NO, [[UIScreen mainScreen] scale]);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Expand Down

0 comments on commit ea5b1b1

Please sign in to comment.