andreamazz / andreamazz/AMPopTip
Poptips can appear off screen
- Ngôn ngữ chính
- Swift
- Star
- 3.3k
- Fork
- 449
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Thanks for the great framework!
Wanted to report what seems like a bug with a similar behavior to #133.

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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.