我希望键盘在某个出现时自动UITextView
出现。现在,第一次UITextView
出现时,用户必须点击它才能出现键盘。随后的出现UITextView
自动使键盘出现。我怎样才能在第一次UITextView
出现时做到这一点?
-(void)displayComposeScreen
{
[self.nameField resignFirstResponder]; //This is a different UITextView, but my issue doesn't change whether I leave this line in or take it out
if (!self.textView)
{
self.textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 20, 280, 150)]; //This is the UITextView with whose appearance I want the keyboard to appear automatically.
self.textView.font = [UIFont fontWithName:@"Helvetica Neue" size:14];
self.textView.delegate = self;
}
[self.textView becomeFirstResponder];
self.textView.hidden=NO;
if (self.ghhaiku.userIsEditing==NO)
{
self.textView.text = @"";
}
else
{
self.textView.text = self.ghhaiku.text;
}
[self.view addSubview:self.textView];
}
基本上,第一次调用此方法时,用户必须点击self.textView
键盘才能出现,我希望键盘在调用该方法时自动出现,就像随后调用此方法一样。