Xamarin iOS (9.2): Gesture not working in emulator -


can explain reason why code isn't working? i'm trying create multi selection uipicker in ios adding uitableviewcell view in uipickermodel, add uitapgesturerecognizer each cell.

but emulator doesn't respond click touchpad.

this code:

class pickerdatamodel : uipickerviewmodel {     /*     <summary>         items wish display     </summary>     */     public list<string> items { get; private set; }      public pickerdatamodel()     {         items = new list<string>();     }      /*     <summary>         called picker number of spinner items     </summary>     */         public override nint getrowsincomponent(uipickerview picker, nint component)     {         return items.count;     }      /* <summary>called picker number of spinner items</summary> */         public override nint getcomponentcount(uipickerview picker)     {         return 1;     }      /* <summary>called when row selected in spinner</summary> */     public override void selected(uipickerview picker, nint row, nint component)     {      }      /*      <summary>         custom row view.         view param reusable view row. null initially.          can add subviews or within view. lazy-initialization          block preferred rather every time method called.          **note** gettitle() no longer overridden since aren't using          default row view.     </summary>     */     public override uiview getview(uipickerview picker,                                     nint row, nint component, uiview view)     {         if (view == null)         {             cgsize rowsize = picker.rowsizeforcomponent(component);             uitableviewcell cell =                      new uitableviewcell(new cgrect(new cgpoint(0, 0), rowsize));             view = cell;             cell.backgroundcolor = uicolor.clear;             cell.userinteractionenabled = true;             uitapgesturerecognizer singletapgesturerecognizer =                                              new uitapgesturerecognizer();             singletapgesturerecognizer.addtarget(() => console.writeline("tapped"));             singletapgesturerecognizer.numberoftapsrequired = 1;             cell.addgesturerecognizer(singletapgesturerecognizer);              cell.textlabel.text = items[(int) row];              cell.tag = row;                             }         return view;     }      void test()     {         console.writeline("tapped");     }      private void toggleselection(uitapgesturerecognizer recognizer)     {                             ((uitableviewcell)recognizer.view).accessory = uitableviewcellaccessory.checkmark;     } } 

you need set delegate in gesture recognizer , implement method return true:

https://developer.xamarin.com/api/member/uikit.uigesturerecognizerdelegate.shouldrecognizesimultaneously/p/uikit.uigesturerecognizer/uikit.uigesturerecognizer/


Comments