Skip to content

Instantly share code, notes, and snippets.

@StuartMorris0
Created August 25, 2014 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StuartMorris0/30afe4395321d075ad3a to your computer and use it in GitHub Desktop.
Save StuartMorris0/30afe4395321d075ad3a to your computer and use it in GitHub Desktop.
Hiding Selector Warnings for methods declared up the chain of responders.

With button selectors you can implement the @selector but might choose to implement the method in the View Controller and not the button subclass for example. You will receive an undeclared selector warning for this to let you know the method is not implemented but this is acceptable behaviour, so you can use the following to hide the warnings.

// Ignore undeclared selector warnings as this method is implemented in the VC
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
[moreButton addTarget:nil action: @selector(userPressedShareBasementButton:) forControlEvents: UIControlEventTouchUpInside];
#pragma clang diagnostic pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment