The selection cursor of the cell in the tableview follows the selected textfield in the cell

Ideas:

Determine which row is selected by getting the parent class of textfield

 

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
    
    
    NSIndexPath *myIndex = [_wifi_detali_tableView indexPathForCell:(UITableViewCell*)[[textField superview]superview]];
    NSLog(@"MyIndex.row = %ld",myIndex.row);
    [_wifi_detali_tableView selectRowAtIndexPath:myIndex animated:NO scrollPosition:UITableViewScrollPositionNone];
    
    return YES;
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326069425&siteId=291194637