小编sau*_*abh的帖子

键盘不适用于uiactionsheet中的textfield

我在uiactionsheet中添加了textfeld


-(void)showAction {
 printf("getting action ready \n");
 UIActionSheet *asheet = [[UIActionSheet alloc] initWithTitle:@"New Sheet Name" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles: nil];
       [asheet showInView:self.view];  
       [asheet setFrame:CGRectMake(0, 70, 320,200)];
       UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 100,200, 25)];
 textField.borderStyle= UITextBorderStyleRoundedRect;
 [textField becomeFirstResponder];
 [textField setKeyboardType:UIKeyboardTypeAlphabet];
 [textField setKeyboardAppearance:UIKeyboardAppearanceAlert];
 textField.text=@"test" ;
 textField.delegate=self;
 [asheet insertSubview:textField atIndex:0];
 [textField release];
 [asheet release];
}
Run Code Online (Sandbox Code Playgroud)

但键盘不适用于此文本字段,但退格正在工作.以前,当我一直在使用ios 3它工作正常,但与ios 3.2 iphone模拟器4.0不接受任何键盘输入


- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
 printf("\n textFieldShouldBeginEditing\n ");
 return YES;
}
这被称为


- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
 printf("shouldChangeCharactersInRange  %s ",[string UTF8String]);
 return YES; …
Run Code Online (Sandbox Code Playgroud)

uitextfield uiactionsheet

2
推荐指数
1
解决办法
2637
查看次数

标签 统计

uiactionsheet ×1

uitextfield ×1