I am beginner in iOS In one of my activity I have created custom picker view with search bar .....Actually I am using YHCPicker class for custom picker view and search bar and apply this on TextField Code here.....
UITextField* StateId;
StateId=[[UITextField alloc]initWithFrame:CGRectMake(150,540,150,30)];
StateId.font = [UIFont boldSystemFontOfSize:12.0];
StateId.borderStyle = UITextBorderStyleLine;
StateId.delegate = self;
StateId.tag = 4;
[scrollview addSubview:StateId];
and I am using this delegate for this textfield....
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if (textField.tag==4)
{
View_StateID = [[NSMutable Array]allocinitWithArray:@"Delhi", @"Rajasthan"......, nil];
NSLog(@"dict is %@",View_StateID);
PickerView* objYHCPickerView = [[PickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 480) ];
objYHCPickerView.delegate = self;
[self.view addSubview:objYHCPickerView];
[objYHCPickerView showPicker:View_StateID];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
then call method ShowPicker in YHCPickerView and I show this picker with search bar on my view.....like as image
Now in this image when we search in search bar first time then get desired state successfully and click on done or search button(from keybord) then get value on StateID textfield but when we again tap on text field then my image as well as but tap on searchbar then get error like this....
-[CALayer keyboardWillShowNotification:]: unrecognized selector sent to instance 0xaad8950
So I don't know what problem ....so solve this problem...