Home > Software design >  Button in tip view create by EasyTipView
Button in tip view create by EasyTipView

Time:10-18

I'm using EasyTipView to create a custom tip view have a button inside look like the image below. But notthing happen when I click to button inside tip view. Does anyone have use this libray and know how to fix this problem ?

My demo: github.com/minhtien1403/TestTipView

Library link: enter image description here

View hierarchy is fine, nothing overlay the button

View hierarchy is fine, nothing overlay the button

CodePudding user response:

As from your github demo, I notice things make button click inside not working.

First of all, in your CustomTipView when ever you change to position, you call translatesAutoresizingMaskIntoConstraints to redefine view which make the xib not working correctly anymore. Just need to remove this

fileprivate func arrange(withinSuperview superview: UIView) {
       // your others code
       if case .view(let contentView) = content {
            contentView.translatesAutoresizingMaskIntoConstraints = false // remove this
            contentView.frame = getContentRect(from: getBubbleFrame())
        }
       // your others code
}
  • Related