ios - UISegmentedControl and NSString
- by Jeff Kranenburg
Hello I have the following code:
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];
I am wanting to have the NSString output the string the user selects in the segmented control.
How do I append the initWithFormat: so that it reflects the chosen index?
Cheers