Reputation: 560
i have array with names, these array i pushed to tableView. Now i'm getting string from row, but need to get row int number.
how i get string name
if(searching)
{
[delegate nameObject:[search objectAtIndex:row.row]];
}
else
{
[delegate nameObject:[[[Data sharedData] ObjectsArray] objectAtIndex:row.row]];
}
and
-(void)nameObject:(NSString*)name
{
if(name != Nil && ![name isEqual:@""])
{
// some code
}
}
Upvotes: 1
Views: 88
Reputation: 11801
If you need number of row which you selected, implement UITableViewDelegate
method:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// This is you row int number
NSInteger myIndex = indexPath.row;
// This is how you get your name from dataSource
NSString * myName = [[[Data sharedData] ObjectsArray] objectAtIndex:myIndex];
}
Upvotes: 2