不兼容的指针类型将'id'发送到'SEL_Notnull'类型的参数

时间:2017-05-10 09:49:13

标签: objective-c pointers casting automatic-ref-counting

[contactCell.no5 addTarget:self action:[self performSelector:@selector(numberEdit:cellIndex:) withObject:contactCell.no5 withObject:[NSNumber numberWithInteger:indexPath.row]] forControlEvents:UIControlEventValueChanged];

in contactCell.no5“no5 is textfield”和“contactCell is uitableviewcell object”...

  1. 不兼容的指针类型将'id'发送到'SEL_Notnull'类型的参数
  2. ARC不允许将Objective-C指针隐式转换为'SEL_Notnull'
  3. 功能 - >

    -(void)numberEdit:(UITextField *)textField cellIndex:(NSNumber *)row
    {    
        [numberList removeObjectAtIndex:[row integerValue]];
        NSLog(@"%@",numberList.description);
    
        [numberList insertObject:textField.text atIndex:[row integerValue]];
        NSLog(@"%@",numberList.description);
    }
    

1 个答案:

答案 0 :(得分:0)

试试这个

如果你有这样的文本字段:

UITextField *contactCell;

你需要添加targetLikeThis

 [contactCell addTarget:self action:@selector(numberEdit:cellIndex:) forControlEvents:UIControlEventValueChanged];

堡垒自定义行动:

-(void)numberEdit:(UITextField *)textField cellIndex:(NSNumber *)row
{    
    [numberList removeObjectAtIndex:[row integerValue]];
    NSLog(@"%@",numberList.description);

    [numberList insertObject:textField.text atIndex:[row integerValue]];
    NSLog(@"%@",numberList.description);
}