[ALOY-600] Ability for baseController to handle events marked up in descendant views.
|Affected Version/s||Alloy 1.0.0|
|Fix Version/s||2013 Sprint 16|
DescriptionThis error happens upon loading a controller when the view references an event handler that is only present in the baseController. [ERROR] : Invalid type passed to function. expected: KrollCallback, was: NSNull in -[TiProxy addEventListener:] (TiProxy.m:797) Discussion: http://developer.appcelerator.com/question/149760/how-to-use-common-event-handlers-in-basecontroller-inherited-controller#comment-163640 Example project: https://github.com/jbeuckm/AlloyBaseControllerEventHandler
- Tony Lukasavage 2013-08-05 Alloy's current inheritance is fairly limited, and there's a few things in the sample code that are not supported: * Inheritance involving any UI in the derived class * Inheritance involving markup events (a subset of the first point) That said, deferring event handlers to an derived class can still be achieved with a bit of a deeper understanding of he inheritance possibilities that Alloy does in fact provide. Below is a test case that should show you how to do so, which comments interspersed to make clear why things are done a certain way. I'm putting it in a gist as it includes a number of files and it would be messy to include it all here: https://gist.github.com/tonylukasavage/6158759 Running that example will allow Alloy to make use of an inherited event handler, albeit in a slightly more complex manner.