我有一种情况,我有一个警报视图,其中以编程方式绘制了一个文本字段
UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@"Welcome" message:@"Enter you name" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
[nameField setBorderStyle:UITextBorderStyleRoundedRect];
[nameField setPlaceholder:@"Enter Owners name"];
[nameField setTextAlignment:UITextAlignmentCenter];
[nameField setDelegate:self];
[nameField setBackgroundColor:[UIColor clearColor]];
[alertView addSubview:nameField];
CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, -80.00);
[alertView setTransform: moveUp];
[alertView show];
[alertView release];
隐藏我用过的键盘
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
但键盘并没有隐藏。请帮助我。