UIPickerView 替换键盘,当调用[textfield resignFirstResponce] 的时候程序就崩溃了

morningXi 发布于 2015/10/06 20:32
阅读 252
收藏 0
iOS
代码:

-(void)addPickerView

{

    UIPickerView *pickView = [[UIPickerView alloc]init];

    pickView.delegate = self;

    self.categoryFiled.inputView = pickView;

}

#pragma mark  PickerView代理


-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView

{

    return 1;

}

-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component

{

    return self.categoryArray.count;

}

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component

{

        return self.categoryArray[row];

}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component

{

    self.categoryFiled.text = self.categoryArray[row];

}


-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

{

    if([self.categoryFiled  isFirstResponder])

    {

        [self.categoryFiled resignFirstResponder];

    }

}

错误提示:

category:]: unrecognized selector sent to instance 0x7fb8bbf4d760

2015-10-06 20:21:05.573 MyApp[1143:21876] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CXAddNewPlanVC category:]: unrecognized selector sent to instance 0x7fb8bbf4d760'

加载中
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部