Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Using Xam.iOS Version: 18.104.22.168 (Business Edition) on a Mac (Mountain Lion 0S 10.8.4)
If I create a UIStepper in Xcode and set it to be an outlet, I am able to set the properties correctly, the app compiles and the view works as it should.
If I create a UIStepper and set it to be an Action, I am unable to set the properties at all and the app dies before showing the view the stepper is on.
It looks as if the steppers are instantiated correctly when they are an outlet, and not at all when they are an action. According to all of the examples I've found online, I should be able to still set the properties if the stepper is an action as well as link it to the ValueChanged event.
Can you attach a simple test app I can use to reproduce this?
Created attachment 4403 [details]
Build and run. Click on the button and watch a null reference get thrown - the stepper isn't instantiated on the StepperBug view by the looks of it.
It works fine if it's set as an outlet rather than action.
In your sample, this code crashes:
NavigationController.PushViewController(new StepperBug(), true);
because NavigationController is null. In fact it crashes even if StepperBug is never created, for example:
D'oh - quick example, sorry. If NavController is not null, the crash still exists.
In that case I get this exception:
Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[StepperBug stepUpDown:]: unrecognized selector sent to instance 0x7c95a520
which is because StepperBug hasn't implemented the stepUpDown method. Adding this code to StepperBug.cs makes it work:
partial void stepUpDown (MonoTouch.Foundation.NSObject sender)
Right, so the behaviour is correct then?
Surely any of the actions should auto generate a stub code then? Might be worth an addition in any case to the Xamarin docs on UIStepper (which isn't covered at all anywhere).
Yes, as far as I can see this is correct.
This is the way actions work: you have to implement the corresponding method yourself. We do generate a partial method declaration in the designer file so that you get code completion in your main file (type "partial " and a list of all the partial methods will show up). Note that this is not limited to UIStepper, it's the same for all actions.