How to pass variable to new method I call when using @selector(methodname)

前端 未结 4 1177
自闭症患者
自闭症患者 2020-12-22 05:58

Ok very quick question. I am adding annotations to my iOS using MKMapAnnotation. I create a int and an annotation with a disclosure button Which calls the method loadPano l

4条回答
  •  甜味超标
    2020-12-22 06:37

    You can not pass values other than sender and eventType in target-action methods.

    The action message may optionally include the sender and the event as parameters, in that order.

    If that integerVariable is a constant, then you can set it as a tag for the control from which you are initiating that action (in your case it is disclosureButton).

    or

    You can take an instance variable in your class, and access that value in loadPano method.

提交回复
热议问题