Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wear #352

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

wear #352

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion MGSwipeTableCell/MGSwipeTableCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,14 @@ typedef NS_ENUM(NSInteger, MGSwipeEasingFunction) {
/** optional to use contentView alternative. Use this property instead of contentView to support animated views while swiping */
@property (nonatomic, strong, readonly, nonnull) UIView * swipeContentView;

/**
/**
* Abacus property to allow grouped cells
*
*/
@property (nonatomic, assign) UIEdgeInsets contentInsets;
@property (nonatomic, assign) CGFloat cornerRadius;

/**
* Left and right swipe buttons and its settings.
* Buttons can be any kind of UIView but it's recommended to use the convenience MGSwipeButton class
*/
Expand Down
15 changes: 9 additions & 6 deletions MGSwipeTableCell/MGSwipeTableCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -813,19 +813,21 @@ -(void) createSwipeViewIfNeeded
{
UIEdgeInsets safeInsets = [self getSafeInsets];
if (!_swipeOverlay) {
_swipeOverlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.contentView.bounds.size.height)];
_swipeOverlay = [[UIView alloc] initWithFrame:CGRectMake(self.contentInsets.left, 0, self.bounds.size.width-self.contentInsets.left - self.contentInsets.right, self.contentView.bounds.size.height)];
[self fixRegionAndAccesoryViews];
_swipeOverlay.hidden = YES;
_swipeOverlay.backgroundColor = [self backgroundColorForSwipe];
_swipeOverlay.layer.zPosition = 10; //force render on top of the contentView;
[_swipeOverlay setAccessibilityLabel:@"Swipe Overlay"];
_swipeOverlay.clipsToBounds = YES;
[self.contentView addSubview:_swipeOverlay];
_swipeView = [[UIImageView alloc] initWithFrame:_swipeOverlay.bounds];
_swipeView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_swipeView.contentMode = UIViewContentModeCenter;
_swipeView.clipsToBounds = YES;
[_swipeView setAccessibilityLabel:@"Swipe View"];
[_swipeOverlay addSubview:_swipeView];
[self.contentView addSubview:_swipeOverlay];
}

[self fetchButtonsIfNeeded];
if (!_leftView && _leftButtons.count > 0) {
_leftSwipeSettings.allowsButtonsWithDifferentWidth = _leftSwipeSettings.allowsButtonsWithDifferentWidth || _allowsButtonsWithDifferentWidth;
Expand All @@ -849,7 +851,6 @@ -(void) createSwipeViewIfNeeded
_rightView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
[_swipeOverlay addSubview:_rightView];
}

// Refresh safeInsets if required
if (_leftView) {
[_leftView setSafeInset:safeInsets.left extendEdgeButton:_leftSwipeSettings.expandLastButtonBySafeAreaInsets isRTL: [self isRTLLocale]];
Expand All @@ -860,6 +861,9 @@ -(void) createSwipeViewIfNeeded
}
}

-(void) updateSwipeFrames {

}

- (void) showSwipeOverlayIfNeeded
{
Expand Down Expand Up @@ -922,7 +926,6 @@ -(void) hideSwipeOverlayIfNeededIncludingReselect: (BOOL) reselectCellIfNeeded
[_tableInputOverlay removeFromSuperview];
_tableInputOverlay = nil;
}

if (reselectCellIfNeeded) {
self.selectionStyle = _previusSelectionStyle;
NSArray * selectedRows = self.parentTable.indexPathsForSelectedRows;
Expand Down