UITextField成为FirstFirstResponder在iOS6中不起作用

时间:2012-10-10 15:14:14

标签: objective-c ios uitextfield ios6

我有一个UITextField,它是UIView的子视图,设置为UITableView的tableHeaderView。 出于某种原因,在iOS6中单击时,文本字段不会调用键盘(在以前的操作系统中,它可以正常工作)。

实施非常简单.. 任何想法可能是什么问题?

感谢名单!

1 个答案:

答案 0 :(得分:0)

以下是代码:

_tracksTableView.tableHeaderView = _tableHeaderView;  //this view contains the     _playlistNameTextField

- (IBAction)saveButtonClicked
{
    [self toggleTextField];
}

- (void)toggleTextField
{
   if (_textFieldVisible)
   {

    [_playlistNameTextField resignFirstResponder];
    [_playlistNameTextField fadeOut:0.2 delegate:self];
    [_saveAsPalylistButton fadeIn:0.2 delegate:self];
            _textFieldVisible = NO;
    }
   else 
   {
            [_playlistNameTextField setText:@""];
            [_saveAsPalylistButton fadeOut:0.2 delegate:self];
            [_playlistNameTextField fadeIn:0.2 delegate:self startSelector:nil      stopSelector:@selector(launchKeyboard)];
            UIBarButtonItem *barButton = [self barButtonItemWithTitle:NLS(@"Cancel") action:@selector(toggleTextField)];
            [barButton.customView setFrame:CGRectMake(0.0, 0.0, barButton.customView.frame.size.width, _playerTitleView.frame.size.height)];
            self.navigationItem.leftBarButtonItem = barButton;
           _textFieldVisible = YES;
    }
}

- (void)launchKeyboard
{
    [_playlistNameTextField becomeFirstResponder];
}