MGSwipeTableCell icon indicating copy to clipboard operation
MGSwipeTableCell copied to clipboard

Right Buttons are covered iPhone X when landscape

Open VicZhang1 opened this issue 8 years ago • 16 comments

On iPhone X landscape, the right buttons are covered by status bar.

VicZhang1 avatar Oct 26 '17 06:10 VicZhang1

Screenshot?

mrhaxic avatar Nov 07 '17 17:11 mrhaxic

Yes, the behaviour is totally wrong on iPhone X.

pronvit avatar Nov 08 '17 11:11 pronvit

Thanks for the screenshots. I'll take a look.

MortimerGoro avatar Nov 08 '17 11:11 MortimerGoro

Sorry no need for screenshots as it's easy to notice in simulator, and also animation is wrong too.

pronvit avatar Nov 08 '17 11:11 pronvit

Fixed in 1.6.2 ;)

MortimerGoro avatar Nov 10 '17 21:11 MortimerGoro

it's seems not work after i pull 1.6.4 source code. 2017-11-13 08 29 19

lab0424 avatar Nov 13 '17 00:11 lab0424

Hi, @MortimerGoro , this issue still exists in 1.6.4.

zizicici avatar Nov 13 '17 09:11 zizicici

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.

MortimerGoro avatar Nov 13 '17 11:11 MortimerGoro

Hi, Thanks for your reply. I have some issue about your demo, I built that demo and the notch covered the buttons: image

If I add the code swipeSettings.offset = cell.safeAreaInsets.right; The appearance looks a bit strange: image

In iOS 11, Mail.app expand the first or last button width to make appearance looks good. image

image

zizicici avatar Nov 13 '17 13:11 zizicici

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.

MortimerGoro avatar Nov 13 '17 14:11 MortimerGoro

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.

zizicici avatar Nov 13 '17 17:11 zizicici

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 ;)

MortimerGoro avatar Nov 18 '17 00:11 MortimerGoro

I have built the demo, and I have an issue with 1.6.5.

Reproduce steps:

  1. Build the demo image

2.Swipe cell image

3.Rotate to landscape mode image

4.Swipe back the cell image

5.Rotate to portrait mode image

6.Swipe the cell image

zizicici avatar Nov 18 '17 06:11 zizicici

@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 ;)

MortimerGoro avatar Nov 18 '17 15:11 MortimerGoro

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: image

In my project: image

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.

zizicici avatar Nov 29 '17 02:11 zizicici

@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.

MortimerGoro avatar Nov 29 '17 09:11 MortimerGoro