Gesture Recognizers and Blocks

后端 未结 1 536
南旧
南旧 2021-01-26 13:44

Can we use blocks with Gesture Recognizers? It doesn\'t appear so. For example, this does not work:

UITapGestureRecognizer *tapped = [[UITapGestureRecognizer a         


        
相关标签:
1条回答
  • 2021-01-26 13:59

    However, this should:

    UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:[^{
        // do stuff
    } copy] action:@selector(invoke)];
    

    You shouldn't probably do this, however, since it's a private method.

    0 讨论(0)
提交回复
热议问题