nextControl not working when we create custom view using xib.
Describe the bug
I have created CoachMarkBodyView with xib. I have return unbutton as nextControl which I have connected using outlets. Now I am not able to click on next button.
To Reproduce
Expected behavior
Actually I should able to click on next button and it should show next instruction.
Hi @parth-simformsolutions, thanks for reporting the problem. This is a very vague issue, do you have more information or a minimal project you can share?
How/where do you instantiate your XIB?
Hi! I'm sorry I intervene, but I did too, Here's my code:
import UIKit
import Instructions
class ProfileCoachMarkView: UIView, CoachMarkBodyView {
@IBOutlet private weak var labelMessage: UILabel!
@IBOutlet weak var buttonOK: UIButton!
var nextControl: UIControl? { return self.buttonOK }
weak var highlightArrowDelegate: CoachMarkBodyHighlightArrowDelegate?
static let popupWidth = UIScreen.main.bounds.width
static func fromNib() -> ProfileCoachMarkView {
return Bundle(for: ProfileCoachMarkView.self).loadNibNamed(String(describing: ProfileCoachMarkView.self), owner: nil, options: nil)![0] as! ProfileCoachMarkView
}
static func viewPopup() -> ProfileCoachMarkView {
let viewBody = ProfileCoachMarkView.fromNib()
viewBody.buttonOK.accessibilityIdentifier = "AccessibilityIdentifiers.next"
viewBody.frame = CGRect(x: 0, y: 0, width: ProfileCoachMarkView.popupWidth - 32, height: ProfileCoachMarkView.popupWidth * 0.35)
viewBody.isUserInteractionEnabled = true
viewBody.buttonOK.isUserInteractionEnabled = true
return viewBody
}
}
And i instantiate, like this:
extension ProfileViewController: CoachMarksControllerDataSource, CoachMarksControllerDelegate {
func coachMarksController(
_ coachMarksController: CoachMarksController,
coachMarkViewsAt index: Int,
madeFrom coachMark: CoachMark
) -> (
bodyView: (UIView & CoachMarkBodyView),
arrowView: (UIView & CoachMarkArrowView)?
) {
let viewBody = ProfileCoachMarkView.viewPopup()
return (bodyView: viewBody, arrowView: nil)
}
func coachMarksController(_ coachMarksController: CoachMarksController, coachMarkAt index: Int) -> CoachMark {
return self.coachMark ?? coachMarksController.helper.makeCoachMark(for: tableView)
}
func numberOfCoachMarks(for coachMarksController: CoachMarksController) -> Int {
return 1
}
}
I followed the custom view example, but used xib, am i miss some configurations or something?
Thank you!
Hey @seirifat, what problem do you see exactly with that code? Anything pops up in the console?
Hi,
I'm having the same problem but only on iPad, when i tap on Next nothing happens, created custom target for the button but also nothing happens.
It's working fine on iPhone.
Hi, facing same issue. Please help me to overcome this 🥹.