2012-10-10 90 views
0

我有一個UITextField是UIView的子視圖,它被設置爲UITableView的tableHeaderView。 出於某種原因,文本框不會在iOS6中單擊時調用鍵盤(在以前的操作系統中它工作得很好)。UITextField becomeFirstResponder不工作在iOS6

執行很簡單.. 任何想法可能是什麼問題?

Thanx!

+2

一些代碼,請在下面 –

+0

增加,得益於 – Lirik

回答

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]; 
} 
+0

這得到了解決。該函數: - (BOOL)canBecomeFirstResponder(在我的控制器的基本視圖控制器中重寫)應返回FALSE。 – Lirik

相關問題