开发者

How to add a UISwitch to a cell in a grouped table view?

开发者 https://www.devze.com 2023-01-28 01:39 出处:网络
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.

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消