我想通过 for 循环加载我的选择器。从 1 到 999。我手动加载。
我的代码在这里。我如何使用“for 循环”自动加载。谢谢
- (void)numberWasSelected:(NSNumber *)selectedIndex element:(id)element;
@synthesize numbers = _numbers;
@synthesize selectedIndex = _selectedIndex;
self.numbers = [NSArray arrayWithObjects:@"1", @"2", @"3",............@"999" nil];
- (IBAction)selectNumbers:(UIControl *)sender {
[ActionSheetStringPicker showPickerWithTitle:@"Select a number !" rows:self.numbers
initialSelection:self.selectedIndex target:self
successAction:@selector(numberWasSelected:element:)
cancelAction:@selector(actionPickerCancelled:) origin:sender];
}
- (void)numberWasSelected:(NSNumber *)selectedIndex element:(id)element {
self.selectedIndex = [selectedIndex intValue];
self.numberTextField.text = [self.numbers objectAtIndex:self.selectedIndex];
}