你好,我有以下代码:IOS - UISegmentedControl和的NSString
if(_deviceSegmentCntrl.selectedSegmentIndex == 0)
{
deviceOne = [[NSString alloc] initWithFormat:@"string01"];
}
if(_deviceSegmentCntrl.selectedSegmentIndex == 1)
{
deviceOne = [[NSString alloc] initWithFormat:@"string02"];
}
if(_deviceSegmentCntrl.selectedSegmentIndex == 2)
{
deviceOne = [[NSString alloc] initWithFormat:@"string03"];
}
NSString *deviceType = [[NSString alloc] initWithFormat:_deviceSegmentCntrl];
我想拥有的NSString输出的用户选择分段控制的字符串。
我该如何附加initWithFormat:以便它反映所选的索引?
干杯
超级!!!对字符串的建议+1和工作的答案喜欢魅力:-) –