I'm currently loading a -UITextField programmatically and trying to make the keyboard go down once I click on 'Search'.
I declare the -UITextFeild inside the .m file as UITextField *searchTextField;
Inside the .h file I do indeed declare the -UITextField's delegate
@interface firstChannel : UIViewController<LBYouTubePlayerControllerDelegate, UITableViewDelegate,UITableViewDataSource, NSXMLParserDelegate, UITextFieldDelegate, AVPlayerItemOutputPullDelegate>{ This is how I add the UITextField programmatically.
searchTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, -26, 300, 30)]; searchTextField.borderStyle = UITextBorderStyleRoundedRect; searchTextField.font = [UIFont fontWithName:@"Heiti TC" size:13]; searchTextField.autocorrectionType = UITextAutocorrectionTypeNo; searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing; searchTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; searchTextField.placeholder = @"Search on the Channel"; searchTextField.borderStyle = UITextBorderStyleNone;; searchTextField.textAlignment = UITextAlignmentCenter; searchTextField.center = CGPointMake(160, 43); searchTextField.textColor = [UIColor colorWithRed:(232.0/255.0) green:(232.0/255.0) blue:(232.0/255.0) alpha:(100.0/100.0)]; searchTextField.clearButtonMode = UITextFieldViewModeNever; searchTextField.returnKeyType = UIReturnKeySearch; [searchTextField setKeyboardAppearance:UIKeyboardAppearanceAlert]; [self.view.window addSubview:searchTextField]; [searchTextField becomeFirstResponder]; I added the delegate inside -viewDidLoad
searchTextField.delegate = self; However when I click on "Search" on the keyboard nothing happens. I'm unsure why that's happening I've even debugged it by logging something once you hit returns but nothing happens.
delegate.searchTExtField.delegatemade before or after you create and setup the text field? Make sure it is done after.