[英]How to add a UISwitch to a cell in a grouped table view?
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. 在这一点上,我想向每个单元格添加UISwitches(已经设置了它们的属性)。 How can I do that? 我怎样才能做到这一点?
The easiest way is to add a UISwitch
as the accessory view for the UITableViewCell
. 最简单的方法是将UISwitch
添加为UITableViewCell
的附件视图。
UISwitch* aswitch = [[UISwitch alloc] initWithFrame:CGRectZero];
aswitch.on = YES; // or NO
cell.accessoryView = aswitch;
[aswitch release];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.