~If you would like to request a tutorial, email Collateral at collateraldamag3@gmail.com~

Share This!

iPhone Tutorial ~ UISwitch Colors

in




Alternate UISwitch Color. If you've ever used an iPhone, you've definitely seen the orange "AirPlane Mode" switch, designed to say "Hey, I'm here, switch me!". Well here's a tutorial about how to do it yourself. But be careful, this uses undocumented API's and Apple can/will reject your app for doing this. 


But as for it being so naughty and getting your app rejected, its actually VERY simple and requires only one line of code:




UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(50, 100, 0, 0)];
[mySwitch setAlternateColors:YES]; // OrangeColor
/* Do Stuff Here. */
[self.view addSubview:mySwitch];
[mySwitch release];

Thats it. It's THAT simple. Thanks again to Skylar for showing me this tip.


~Collateral

No comments:

Post a Comment

This entry is filed under .

You can also follow any responses to all entry through the RSS Comments feed.