tableview中cell的选中光标跟随cell中被选中的textfield

思路:

通过获取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;
}

猜你喜欢

转载自jameskaron.iteye.com/blog/2404047