Open VicZhang1 opened 7 years ago
Screenshot?
Yes, the behaviour is totally wrong on iPhone X.
Thanks for the screenshots. I'll take a look.
Sorry no need for screenshots as it's easy to notice in simulator, and also animation is wrong too.
Fixed in 1.6.2 ;)
it's seems not work after i pull 1.6.4 source code.
Hi, @MortimerGoro , this issue still exists in 1.6.4.
I fixed some calculations and animations (e.g. the behaviour is correct now on the opposite side of the notch, animations are ok).
In order to avoid covering the buttons on the side of the notch, you can do:
-(NSArray*) swipeTableCell:(MGSwipeTableCell*) cell swipeButtonsForDirection:(MGSwipeDirection)direction
swipeSettings:(MGSwipeSettings*) swipeSettings expansionSettings:(MGSwipeExpansionSettings*) expansionSettings
{
if (direction == MGSwipeDirectionRightToLeft) {
swipeSettings.offset = cell.safeAreaInsets.right; // TODO: add availabilty checks to use safeAreaInsets
}
(...)
}
I'm thinking on automatically detecting this in the library, but may need some orientation checking to detect the side of the notch. I'll let you know how I include it.
Hi, Thanks for your reply. I have some issue about your demo, I built that demo and the notch covered the buttons:
If I add the code swipeSettings.offset = cell.safeAreaInsets.right;
The appearance looks a bit strange:
In iOS 11, Mail.app expand the first or last button width to make appearance looks good.
In iOS 11, Mail.app expand the first or last button width to make appearance looks good.
Thanks for the info. I still haven't been able to test mail on iPhone X to see how they solved it (Are you running it on the simulator?)
I'll set that solution as the default behaviour. I'll let you know when the update is ready.
First, I capture the screen shot by using an iPhone X, and drag that shot to the iOS Simulator, then I enable the "Show Device Bezels" in the iOS Simulator, finally I use shift
+ command
+ 4
to capture the last image in macOS.
It's my honor to help you, if you need images of other cases, please tell me free.
1.6.5 published!
By default it mimics the mail app and expands the first or last button width to make appearance look good with the notch.
This behavious can be enabled or disabled on each swipe side by setting expandLastButtonBySafeAreaInsets property to left or right MGSwipeSettings.
Please, let me know if you are happy with the current implementation ;)
I have built the demo, and I have an issue with 1.6.5.
Reproduce steps:
2.Swipe cell
3.Rotate to landscape mode
4.Swipe back the cell
5.Rotate to portrait mode
6.Swipe the cell
@beimen Thanks a lot for the detailed info!
I have published 1.6.6 which better handles those edge cases like orientation changes. It also correctly handles Right to left languages now.
Please try the new version when you can ;)
Good Job. Thanks @MortimerGoro .
But there is something wrong with my project. I used the 1.6.6, demo looks good, my project looks bad. And I find the cause: when I rotate the device, the timing of calling the -(void) setSafeInset:(CGFloat)safeInset extendEdgeButton:(BOOL) extendEdgeButton isRTL: (BOOL) isRTL
in the demo is different with my project( Xcode 9.1 + Swift 4 + iOS 11.1 + iPhone X).
In the demo:
In my project:
The difference made the layout of cell become into a mess.
I cannot find the root cause for many days(Why is - (void)layoutSublayersOfLayer:(CALayer *)layer;
, not cell.layoutSubviews()
), but I think maybe other developers may have the same issue. If you have some ideas about my issue, please let me know.
@beimen It would be very helpful if you could send me a test project that reproduces the problem. It's difficult to guess the problem if I can't reproduce it on my projects.
On iPhone X landscape, the right buttons are covered by status bar.