Hi,
On Wed, Jun 13, 2012 at 5:12 PM, Michal Sartoris <[email protected]> wrote:
> In MT 5.2.12 I’m getting exception "Failed to find selector handleTapFrom:
> on Test.TestViewController+OtherView". I have one UIView derived class
> which creates and adds tap gesture recognizer to itself in constructor.
> Then I have another class derived from previous one. Any tap on second view
> causes exception.
>
>
>
> namespace Test
>
> {
>
> public class TestViewController : UIViewController
>
> {
>
> private OtherView _mainView;
>
>
>
> private class MyView : UIView
>
> {
>
> private
> UITapGestureRecognizer _recognizer;
>
>
>
> public MyView() {
> Initialize(); }
>
>
>
> public
> MyView(System.Drawing.RectangleF frame) : base(frame) { Initialize(); }
>
>
>
> private void Initialize()
>
> {
>
> _recognizer
> = new UITapGestureRecognizer(this, new
> MonoTouch.ObjCRuntime.Selector("handleTapFrom:"));
>
>
> AddGestureRecognizer(_recognizer);
>
> }
>
>
>
> [Export("handleTapFrom:"),
> Preserve()]
>
> private void
> HandleTap(UITapGestureRecognizer recognizer)
>
> {
>
It is because the method is private. You need to make it at least internal.
In any case it looks like a bug to me, so I filed it:
https://bugzilla.xamarin.com/show_bug.cgi?id=5775
Rolf
>
> Console.WriteLine("Tap");
>
> }
>
> }
>
>
>
> private class OtherView : MyView
>
> {
>
> public OtherView() {}
>
> public
> OtherView(System.Drawing.RectangleF frame) : base(frame) {}
>
> }
>
> #endregion
>
>
>
> #region Constructor
>
> public TestViewController() {}
>
>
>
> public override void LoadView()
>
> {
>
> _mainView = new
> OtherView(UIScreen.MainScreen.ApplicationFrame);
>
>
>
> this.View = _mainView;
>
> }
>
> }
>
> }
>
>
>
> Any idea why? Bug? The same works in obj-c.
>
>
>
> Regards
>
> Michal
>
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch