Custom UISwitch & App Store approval

After doing some reading, I've found that you can customize the text and color on a UISwitch control. I'm curious if these methods will cause problems trying to get my app approved and included in the App Store.

Sample code taken from iPhone Developer's Cookbook Sample Code:

// Custom font, color
switchView = [[UICustomSwitch alloc] initWithFrame:CGRectZero];
[switchView setCenter:CGPointMake(160.0f,260.0f)];
[switchView setLeftLabelText: @"Foo"];
[switchView setRightLabelText: @"Bar"];
[[switchView rightLabel] setFont:[UIFont fontWithName:@"Georgia" size:16.0f]];
[[switchView leftLabel] setFont:[UIFont fontWithName:@"Georgia" size:16.0f]];
[[switchView leftLabel] setTextColor:[UIColor yellowColor]]; 

this will not create problems with submitting to the app store. You are allowed to use custom controls or altered versions of the built in controls so long as you do not use any private (undocumented) APIs to build/alter these widgets.


You might enjoy my implementation of a custom switch (open source and free to use)... it allows setting the switch to display any text, or easily subclass it to draw your own custom images in the track.... http://osiris.laya.com/projects/rcswitch/

This switch makes it easy to draw an image instead of text: subclass the main switch class and override the draw method like this, and your image will be automatically animated:

- (void)drawUnderlayersInRect:(CGRect)aRect withOffset:(float)offset inTrackWidth:(float)trackWidth
{
    [onImage drawAtPoint:CGPointMake(floorf(aRect.origin.x + 13 + (offset - trackWidth)), floorf((self.bounds.size.height - onImage.size.height) / 2.0))];
    [offImage drawAtPoint:CGPointMake(floorf(aRect.origin.x + 15.0 + (offset + trackWidth)), ceilf((self.bounds.size.height - offImage.size.height) / 2.0))];
}

No need to UISwitch subclass at all. A fairly simple solution which I Implemented is subclased UIView and on touch event toggled between two images (ON/OFF) with slide transition thats all.

Regards Dhanesh