I am trying to change the text in UISwitch. The sample from the website ( Changing the text on a UISwitch ) works fine but when I upgrade my xcode to 3.2.5 and iOS 4.2, the
Try using a customizable open source UISwitch replacement.
This one seems pretty good: DCRoundSwitch on GitHub, but there are many more on GitHub if that one doesn't work.
This type of approach doesn't have the same incompatibility issues because it implements the switch's functionality and drawing itself and only relies on the core functionality UIControl base class. The only thing you might need to update from time to time is the library you're using (DCRoundSwitch), however, base functionality like UIControl and Quartz drawing are quite established and rarely change so this can safely be considered a rare and minimal risk factor.