UIBarButtonItem: target-action not working?

后端 未结 11 922
无人及你
无人及你 2020-12-01 08:47

I\'ve got a custom view inside of a UIBarButtonItem, set by calling -initWithCustomView. My bar button item renders fine, but when I tap it, it doe

11条回答
  •  眼角桃花
    2020-12-01 09:15

    Jacob, everything looks good, however you may not have provided the correct selector.

    Can you verify that your action is actually declared

    - (void) deselectAll;
    

    and not

    - (void) deselectAll:(id)sender;
    

    If it's the latter, you will need to set the action to @selector(deselectAll:). (note the semi-colon to match the method declaration)

    Also, void might be IBAction, but that's not relevant to this problem you're having.

提交回复
热议问题