2

Since iOS5, UIKit can be customized with custom images. We have an app which must stay compatible with iOS 4, but if a user has iOS 5 we want to customize a slider.

Example:

[[UISlider appearance] setMaximumTrackImage:maxImage forState:UIControlStateNormal];

What's a safe way for checking at runtime if it's OK to do this call? The respondsToSelector: method is for instances only, but here it's a class itself.

Proud Member
  • 40,078
  • 47
  • 146
  • 231
  • 1
    Check this out: http://stackoverflow.com/questions/1135366/class-method-equivalent-of-respondstoselector – Stavash Feb 10 '12 at 19:42

1 Answers1

8

You can use resolveClassMethod: for that, e.g.:

[MYClass resolveClassMethod: @selector(trololo)];

Or you can use respondsToSelector: since classes are also objects in Objective C.

Max
  • 16,679
  • 4
  • 44
  • 57