From aae5eab275b3afa3169a3e074bfd6dc429aab6c0 Mon Sep 17 00:00:00 2001 From: Paul Vowles Date: Thu, 26 Sep 2019 10:33:46 +0800 Subject: [PATCH] [Issue #337] Handle swipe with accessory in storyboard mode on iOS13 --- MGSwipeTableCell/MGSwipeTableCell.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MGSwipeTableCell/MGSwipeTableCell.m b/MGSwipeTableCell/MGSwipeTableCell.m index 51a1168..5c8f8f5 100644 --- a/MGSwipeTableCell/MGSwipeTableCell.m +++ b/MGSwipeTableCell/MGSwipeTableCell.m @@ -622,6 +622,7 @@ @implementation MGSwipeTableCell bool _overlayEnabled; UITableViewCellSelectionStyle _previusSelectionStyle; NSMutableSet * _previusHiddenViews; + UITableViewCellAccessoryType _previusAccessoryType; BOOL _triggerStateChanges; MGSwipeAnimationData * _animationData; @@ -1037,6 +1038,19 @@ - (UIImage *)imageFromView:(UIView *)view cropSize:(CGSize)cropSize{ -(void) setAccesoryViewsHidden: (BOOL) hidden { + if (@available(iOS 13, *)) { + // Hide the accessory to prevent blank box being displayed in iOS13-beta + // (blank area would be overlayed in accessory area when using cell in storyboard view) + // This may be fixed in iOS13 production release + if (hidden) { + _previusAccessoryType = self.accessoryType; + self.accessoryType = UITableViewCellAccessoryNone; + } else if (self.accessoryType == UITableViewCellAccessoryNone) { + self.accessoryType = _previusAccessoryType; + _previusAccessoryType = UITableViewCellAccessoryNone; + } + } + if (self.accessoryView) { self.accessoryView.hidden = hidden; }