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
DidTapCheckBox is not called #13
Comments
@omatrot thank you for bringing this issues to my attention. I'll take a look at your issue this week and let you know what I find out. If you have any other information about |
@omatrot I just loaded the example application, which I haven't done in a while, and the Can you please provide more details on your setup and/or an example that demonstrates the bug? Thank you. |
Here's what I'm doing:
Hope that helps, my project is quite complicated I'm not sure I can provide a small repo sample. If the above code works for you then I'll try to reproduce in a fork of the sample project. |
@omatrot I replaced the MainViewController public override void ViewDidLoad()
{
base.ViewDidLoad();
Title = "Binding Example";
var stackView = new UIStackView
{
Axis = UILayoutConstraintAxis.Horizontal,
Distribution = UIStackViewDistribution.EqualSpacing,
Alignment = UIStackViewAlignment.Center,
Spacing = 5,
TranslatesAutoresizingMaskIntoConstraints = false
};
for (int i = 0; i < 5; i++)
{
var checkbox = new BEMCheckBox(new CGRect(0, 0, 25, 25));
checkbox.DidTapCheckBox += DidTapCheckBoxEvent;
checkbox.AnimationDidStopForCheckBox += AnimationDidStopForCheckBoxEvent;
stackView.AddArrangedSubview(checkbox);
}
View.AddSubview(stackView);
stackView.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true;
stackView.CenterYAnchor.ConstraintEqualTo(View.CenterYAnchor).Active = true;
} Try the above and let me know if it works. Could be something else I'm missing or something you haven't shown me yet. I did notice that you remove then re-add the checkbox.DidTapCheckBox -= habitDoneState_Click;
checkbox.DidTapCheckBox += habitDoneState_Click; I don't think you need to do this. Just add it: checkbox.DidTapCheckBox += habitDoneState_Click; |
Can't seem to solve the problem in my project neither reproduce it in a new one. Please stay tuned. |
May be the problem is in the native library, and in this case I have no idea if we could debug it. The only thing that comes to mind is that the delegate in no more registered. Unless we have a BEMCheckbox native version that logs if there is no delegate to call we'll never know. |
Adding the below email from @omatrot to help with debugging this issue:
|
About that comment. I deleted it because it only worked once, on the next run I was not called anymore. |
@omatrot that explains why I saw it my email but not in the issue. Unless you have any objections I would like to leave your comment in the issue to help with debugging the issue. Sorry I'm not able to reproduce your issue. Feel free to send me a reproducible example if you can. You can also check the BEMCheckBox issues and see if someone has reported a similar issue to the one your experiencing. I am planning on doing a new release but there are not many changes in BEMCheckBox since the [1.4.3] (Dec 22, 2017) release. |
Correct me if I'm wrong, but BEMCheckbox is now in Swift, but used to be Objective-C? I've modified the code in a fork to add a NSLog call if the delegate is not called. I can't link my project with a modified version of yours, it fails with the following errors:
Do you have any idea what it takes to expose the Swift code to Objective-C? |
@omatrot you are correct that BEMCheckBox recently migrated to Swift. Version 1.4.3 was built using the objective-c version of BEMCheckBox. I think binding to Swift is similar to Objective-c based on this documentation. How did you bind your forked BEMCheckbox to your project? Do you have an example project I can view to duplicate the problem? Please note I'm currently migrating the build to GitHub Workflows but ran into and issue. Once I get the build sorted out I'll work on updating the XPlugin to consume the Swift version of BEMCheckbox. |
Ok, I want to let you know that I solved my problem by simply subclassing BEMCheckBox. |
I'm using version 1.4.3.
Xamarin.iOS
Version: 13.18.1.31 (Visual Studio Community)
Hash: b3eedfed9
Branch: d16-6
Build date: 2020-04-09 10:22:36-0400
Neither DidTapCheckBox nor AnimationDidStopForCheckBox subscription are working.
The event method is not called.
What could be wrong?
The text was updated successfully, but these errors were encountered: