Objective c 我们能改变一下菜单上的文字吗

Objective c 我们能改变一下菜单上的文字吗,objective-c,uiswitch,Objective C,Uiswitch,我们是否可以更改UI开关上的文本,即打开和关闭。我尝试了以下代码,但它崩溃了 crashLog: 由于未捕获异常NSInvalidArgumentException而终止应用程序,原因:'-[UISwitch setLeftLabelText:]:发送到实例0x4c65020的选择器无法识别'** 用这个 看看这个: 它允许许多定制(包括文本) switcher = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease]; [switc

我们是否可以更改UI开关上的文本,即打开和关闭。我尝试了以下代码,但它崩溃了

crashLog:

由于未捕获异常NSInvalidArgumentException而终止应用程序,原因:'-[UISwitch setLeftLabelText:]:发送到实例0x4c65020的选择器无法识别'**

用这个

看看这个: 它允许许多定制(包括文本)

switcher = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease];
[switcher addTarget:self action:@selector(switchAction:)
forControlEvents:UIControlEventValueChanged];

// swit = [[UISwitch alloc] initWithFrame:CGRectZero];
[switcher setCenter:CGPointMake(160.0f,260.0f)];
[switcher setLeftLabelText: @"Female"];
[switcher setRightLabelText: @"Male"];
[[switcher rightLabel] setFont:[UIFont fontWithName:@"Georgia" size:16.0f]];
[[switcher leftLabel] setFont:[UIFont fontWithName:@"Georgia" size:16.0f]];
[[switcher leftLabel] setTextColor:[UIColor yellowColor]];

cell.accessoryView = switcher;
switcher.tag = indexPath.row;