yysskk / SwipeMenuViewController

Swipable tab and menu View and ViewController.
MIT License
1.29k stars 131 forks source link

Button On Child View Does not perform Action #34

Closed HarooniAtInfocaliper closed 6 years ago

HarooniAtInfocaliper commented 6 years ago

I am using child views to swipe through "Swipe Menu View Controller", In One of two child views i have created a button and create an IBAction Function related to it. when i press the button, it highlighted but not call IB Action Function. Please Help, Below is the code and relevant image of ChildViewController for referance.

import UIKit

class ChildViewController: UIViewController { var trip:String? = nil override func viewDidLoad() { super.viewDidLoad()
} @IBAction func test() { print("Test") }
}

github

mojtaba-almoussawi commented 6 years ago

set the delegate and override method swipeMenuView(_ swipeMenuView: SwipeMenuView, viewControllerForPageAt index: Int) , then before returning the viewController , call addChildViewController method.

override func swipeMenuView(_ swipeMenuView: SwipeMenuView, viewControllerForPageAt index: Int) -> UIViewController { let vc = ChildViewController() addChildViewController(vc) return vc }

yysskk commented 6 years ago

👍