Я новичок в IOS и не могу заставить его работать, в моем приложении есть поле ввода, из которого я хочу скрыть клавиатуру всякий раз, когда пользователь нажимает клавишу возврата или связанную кнопку (searchGo)
Вот мой код:
mainViewController.h
@interface kepnMainViewController : UIViewController <kepnFlipsideViewControllerDelegate, MKMapViewDelegate>
{
MKMapView *_mapView;
IBOutlet UITextField *searchBox;
IBOutlet UIBarButtonItem *searchGo;
IBOutlet UIBarButtonItem *searchNearby;
MKAnnotationView *annotationView;
}
@property (strong, nonatomic) MKMapView *_mapView;
@property (strong, nonatomic) MapAnnotation *annotation;
@property (strong, nonatomic) UIPopoverController *flipsidePopoverController;
@property (strong, nonatomic) MKAnnotationView *annotationView;
@property (strong, nonatomic) UIBarButtonItem *searchGo;
- (IBAction)showInfo:(id)sender;
- (IBAction)searchGo:(id)sender;
- (IBAction)showNearby:(id)sender;
- (IBAction)searchBoxReturn:(id)sender;
- (void) setPlaceMarker: (CLLocationCoordinate2D) coord :(NSString*) title :(NSString*) subtitle;
@end
Подходящий фрагмент .m
-(IBAction)searchGo:(id)sender
{
NSLog(@"sender object %@",sender);
[sender resignFirstResponder];
NSLog(@"search button pressed and textbox = %@",searchBox.text);
}
-(IBAction)searchBoxReturn:(id)sender
{
NSLog(@"search box return ");
[sender resignFirstResponder];
}
Извините, если это глупый вопрос, но что я делаю не так ???