0

I have a UIButton instance inside a UIStackView as shown in the bellow view hierarchy I'm using SwipeView library.

  • UIView
    • UIScrollView
    • UIStackView
    • UIView
    • UIStackView (Horizontal)
      • UILabel - UIButton

I have done everything from setting 'isExclusiveTouch', 'delaysContentTouches' properties to subclassing UIScrollView to override methods (UIScrollview delaysContentTouches issue). None of this has worked out for me so far.

Thanks in advance.

Update

Adding view controller as child fixed the issue

func swipeView(_ swipeView: SwipeView!, viewForItemAt index: Int, reusing view: UIView!) -> UIView! {
let swipeView = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "swipe_view") as! SwipeViewController
                swipeView.loadViewIfNeeded()
                if let stat = userInfo.stats?[index]{
                    swipeView.stat = stat
                }
                //Adding these lines fixed the issue.
                self.addChildViewController(swipeView)
                swipeView.didMove(toParentViewController: self)
                return swipeView.view
                }
rajeeva9
  • 139
  • 12
  • check UIStackView and UILabel's isUserInteractionEnabled property. – Yun CHEN Jun 04 '17 at 08:44
  • @YunCHEN That didn't work. – rajeeva9 Jun 04 '17 at 09:38
  • share some code relevant to button action. and also check the IBAction of the button. – Abdul Rehman Jun 04 '17 at 11:23
  • @AbdulRehmanWarraich I have connected the IBAction from Interface builder. When I tap on the button, It gets animated on the screen but the action is not called. UIButton is also a "drag and drop" from the IB. – rajeeva9 Jun 04 '17 at 13:02
  • If the button *"gets animated on the screen but the action is not called"* then the problem does **not** seem to be with touches or delays... it looks like the `IBAction` is not connected properly. That is where you need to look to find the issue. – DonMag Jun 04 '17 at 14:07
  • share some code to help understanding issue. as @DonMag mentioned you need to look at your IBAction. delete and reconnect it again it may solve the problem. – Abdul Rehman Jun 05 '17 at 06:27
  • @AbdulRehmanWarraich I found out the issue. There's an oversight in the code. I derived the view on Storyboard. I forgot to add the controller as a child of parent. – rajeeva9 Jun 05 '17 at 06:57

0 Answers0