Alex Alex - 15 days ago 5
iOS Question

Selected Index of UI Cell

I am new to iOS programming
I would like to Save the Selected

Cell (cell.detailTextLabel.text)
to another
Textfield
outside of table view in the same
viewController
.
Can anyone suggest me how?

Answer

Use this delegate method of the table view,

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    selectedLabelName = cell.textLabel.text;
}

declare variable name selectedLabelName in your viewcontroller

Comments