如何在ipad的模型视图中隐藏键盘?

时间:2012-08-20 06:52:18

标签: iphone objective-c

当我在这里使用UIModalPresentationFormSheet时如何隐藏键盘当我点击键盘完成按钮时我的键盘没有从modelview中隐藏这个代码中的问题我在这个类中调用了一些错误的方法

-(IBAction)BenefitManage
{
    manage*theManageView=[[[manage alloc]initWithNibName:@"manage" bundle:nil]autorelease];
    [theManageView setDelegate:self];
    theManageView.navigationItem.title =NSLocalizedString(@"Manage", @"Manage");
    navController = [[UINavigationController alloc] initWithRootViewController: theManageView]; 
    navController.modalPresentationStyle=UIModalPresentationFormSheet;
    //theManageView.modalPresentationStyle = UIModalPresentationFormSheet;
   // [self presentModalViewController:theManageView animated:NO];
    [self presentModalViewController:navController animated:YES];

}

2 个答案:

答案 0 :(得分:1)

单击完成按钮时应隐藏键盘。

- (IBAction)done
{
    [self.textField resignFirstResponder];
    ...
}

答案 1 :(得分:0)

这样做:

[self.view endEditing:YES];