andreamazz / andreamazz/AMPopTip

Poptips can appear off screen

Abierto
#178 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Swift
Estrellas
3.3k
Forks
449
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Thanks for the great framework!

Wanted to report what seems like a bug with a similar behavior to #133.

![image](https://user-images.githubusercontent.com/1304735/54304069-b12e0300-45c4-11e9-8b1e-099dda775ad1.png)

In the image the tooltip is being presented from the superview of the people button it is pointing at but it ends up being positioned partially off screen.

The full config for the popTip is
```
popTip.cornerRadius = 8
popTip.textColor = UIColor.black
popTip.bubbleColor = UIColor.white
popTip.borderColor = UIColor.white
popTip.shadowColor = UIColor.black
popTip.shadowRadius = 10
popTip.shadowOffset = CGSize(width: 0, height: 4)
popTip.shadowOpacity = 0.25
popTip.arrowSize = CGSize(width: 18, height: 7)
popTip.edgeMargin = -3
popTip.padding = 16
popTip.shouldDismissOnTapOutside = true
popTip.shouldDismissOnSwipeOutside = true
popTip.shouldDismissOnTap = true
popTip.constrainInContainerView = false
```

Would it make sense to have a property like `constrainOnScreen` that is similar to `constrainInContainerView` except that a check is made to make sure that he tooltip is on screen?

Note that I increased `edgeMargin` to 20 and it had no effect in this case. Another side note is that I set edgeMargin to -3 since if a tooltip is close to the top of the screen and the arrowSize is larger then the tooltip arrow does not render correctly but that is a separate issue I can file.

In the example above the superview is fully on the screen but because of `constrainInContainerView = false` the tooltip is allowed to be laid out off the screen.

Also note that the tooltip could be presented from the keywindow or a top level view controller to avoid being offscreen since the window is full screen and `constrainInContainerView` can be set to `true`, but then if the button (or whatever the tooltip is pointing at) moves then the tooltip is just left floating pointing at nothing. Keeping the tooltip presented from a view close in the view hierarchy avoids a lot of corner case handling for when views move.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.