Changing the text on a UISwitch

前端 未结 3 1844
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 07:48

The UISwitch currently says ON and OFF. Can I change the text to YES and NO?

Would it be hard? Or do I just rephrase the question I ask the user?

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 08:12

    To change the text of an UISwitch e.g. to "Foo/Bar", do the following:

    ((UILabel *)[[[[[[_agreeAgb subviews] lastObject] subviews] objectAtIndex:2] subviews] objectAtIndex:0]).text = @"Foo";
    ((UILabel *)[[[[[[_agreeAgb subviews] lastObject] subviews] objectAtIndex:2] subviews] objectAtIndex:1]).text = @"Bar";
    

提交回复
热议问题