lechec, inputView UITextField UIPickerView. .
, : http://nomtek.com/tips-for-developers/working-with-pickers/ , . XCode 4.2 iOS 5.
, . , UITextField, , " ". UITextField " ", .
-(void)handleViewTapGesture:(UITapGestureRecognizer *)gesture
{
[self endEditing:YES];
}
ViewController. View:
-(void) setLoginView:(LoginView *)loginView
{
_loginView = loginView;
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.loginView action:@selector(handleTapGesture:)];
[tapRecognizer setDelegate:self];
[self.loginView addGestureRecognizer:tapRecognizer];
}
. , . Apple / .
I should mention that you will need additional code to make sure other controls get branched, you need a delegate that implements the UIGestureRecognizerDelegate protocol and this method:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isKindOfClass:[UIButton class]])
return NO;
return YES;
}
source
share