Classes that Support UIAppearance in iOS 5

The other day, I found this this Stack Overflow question about iOS 5′s UIAppearance protocol. One of the things that the poster was looking for, was a list of classes that support UIAppearance proxies.

Is there a list of all classes that are manipulatable with the appearance property?

Until now, there was no such list, but I used a little grep magic to change that. To find the public headers, I secondary-clicked on a Foundation header in Xcode and asked Xcode to show the file in Finder. I ran the following command the iOS SDK directory which contains all of the public headers. (I could have arguably constrained my search to the UIKit directory, but whatever.)

grep -r UI_APPEARANCE_SELECTOR ./ > ~/Desktop/UI_APPEARANCE.txt

According to the selected answer, any UIKit property that supports UIAppearance is going to have UI_APPEARANCE_SELECTOR tacked on to the end of its method prototype. That grep command pulls out the files that contain the relevant method declaration and out them into the file UI_APPEARANCE.txt on my desktop. There are at least 14 UIKit classes that support UIAppearance proxies for at least one of their properties. Those classes are:

  • UIActivityIndicatorView.h
  • UIBarButtonItem.h
  • UIBarItem.h
  • UINavigationBar.h
  • UIProgressView.h
  • UISearchBar.h
  • UISegmentedControl.h
  • UISlider.h
  • UISwitch.h
  • UITabBar.h
  • UITabBarItem.h
  • UIToolbar.h

Interestingly, UIView claims to conform to UIAppearance, so any subclass of UIView can potentially implement UIAppearance support.

You can see the results of the grep command by clicking here.