HI以下是我正在使用的代碼,文本字段是在.h文件中創建的,當我運行代碼時,文本字段不響應鍵盤(無字母鍵入可見)也時我點擊完成keybpard它不會觸發textfieldshould返回的方法。請幫忙!!!動態UITextfield不響應鍵盤輸入
UIActionSheet *aac =[[UIActionSheet alloc] initWithTitle:@"New list item" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
UIDatePicker *theDatePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0.0,100.0,0.0,0.0)];
self.textField=[[UITextField alloc] init];
self.textField.frame = CGRectMake(12, 45, 260, 25);
[self.textField setDelegate:self];
self.textField.textColor=[UIColor blackColor];
self.textField.backgroundColor=[UIColor whiteColor];
[textField setBorderStyle:UITextBorderStyleRoundedRect];
[textField setReturnKeyType:UIReturnKeyDone];
textField.keyboardType=UIKeyboardAppearanceDefault;
[aac addSubview:textField];
[aac addSubview:theDatePicker];
[textField release];
[theDatePicker release];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]];
closeButton.momentary=YES;
closeButton.frame = CGRectMake(270, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle=UISegmentedControlStyleBar;
closeButton.tintColor =[UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet) forControlEvents:UIControlEventValueChanged];
[aac addSubview:closeButton];
[closeButton release];
[aac showInView:self.view];
[aac setBounds:CGRectMake(0, 0, 320, 685)];
您只顯示在操作表中提交的文本? – EmptyStack 2010-12-20 09:13:23
只嘗試過textfield,並有相同的問題 – likki 2010-12-20 23:17:44