Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextControl not working when we create custom view using xib. #253

Open
parth-simformsolutions opened this issue Feb 2, 2021 · 5 comments

Comments

@parth-simformsolutions
Copy link

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.

@ephread
Copy link
Owner

ephread commented Feb 6, 2021

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?

@seirifat
Copy link

seirifat commented May 18, 2021

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!

@ephread
Copy link
Owner

ephread commented May 19, 2021

Hey @seirifat, what problem do you see exactly with that code? Anything pops up in the console?

@yasserosama07
Copy link

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.

@Mukeshkumarmsd
Copy link

Mukeshkumarmsd commented Jul 13, 2023

Hi, facing same issue. Please help me to overcome this 🥹.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants