Wednesday, 28 August 2013

EAActionSheetPicker - get row in delegate method

EAActionSheetPicker - get row in delegate method

Im new to iOS. I am using an EAActionSheetPicker
(https://github.com/EckyZero/EAActionSheetPickerDemo).
I initiate my picker like this:
- (void)initLocationPicker
{
NSMutableArray* names = [[NSMutableArray alloc]
initWithCapacity:_data.count];
for(Model *item in _data)
[names addObject:item.name];
self.locationPicker = [[EAActionSheetPicker alloc]initWithOptions:names];
self.locationPicker.delegate = self;
}
What i want to achieve is that when i press the done-button; I want to
know which index was selected in the picker. I get the actual label by
implementing the delegate method as this:
-(void)EAActionSheetPicker:(EAActionSheetPicker *)actionSheet
didDismissWithSelection:(id)selection
inTextField:(UITextField *)textField{
NSLog(@"selected: %@", selection);
}
How can I know which index that was?
Might perhaps be obvious.
Thanks

No comments:

Post a Comment