So I'm creating a settings page in my app and up to now I开发者_开发技巧've set it up with a grouped table view with both group titles and settings/cell tiles.
At this point I'd like to add UISwitches (Already have their properties set up) to each cell. How can I do that?
The easiest way is to add a UISwitch
as the accessory view for the UITableViewCell
.
UISwitch* aswitch = [[UISwitch alloc] initWithFrame:CGRectZero];
aswitch.on = YES; // or NO
cell.accessoryView = aswitch;
[aswitch release];
精彩评论