andreamazz / andreamazz/AMPopTip

Poptips can appear off screen

オープン
#178 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Swift
スター
3.3k
フォーク
449
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。