2011-08-12 18 views
0

我有TTMessageController這是(CommentViewController)的子類,我有以下映射TTMessageController不能設置它的文本編輯爲firstResponder

[map from:@"tt://postDetails/(initWithPostId:)/(anotherId:)" toViewController:[PostDetailsViewController class]]; 
[map from:@"tt://groupBoardAddComment/(initWithPostId:)/(anotherId:)" toModalViewController:[CommentViewController class]]; 

當我打電話CommentViewController從我PostDetailsViewController類,它的鍵盤不會出現,但是當我把它從它的鍵盤出現我的其他視圖控制器類,

即使我試圖以武力becomeFirstResponder它的文本編輯在所有viewWillAppear中,viewDidLoad中和等米我的CommentViewController方法,仍然無法顯示。

希望回覆,真的需要這方面的幫助,感謝

回答

0

這裏的問題是,我調用該方法時,用戶在我的文本框開始,而不是文本字段的編輯,我把它用選擇器更改爲一個按鈕調用並顯示CommentViewController,

代替此

- (IBAction)textFieldDidBeginEditing:(id)sender { 
    CommentViewController *commentViewController = [[CommentViewController alloc] initWithPostId:self.postId groupId:self.groupId]; 

    UINavigationController *navigationController = [[UINavigationController alloc] 
               initWithRootViewController:commentViewController]; 
    [self presentModalViewController:navigationController animated:YES]; 
    [navigationController release]; 
    [commentViewController release]; 
} 

我由方法通過一個按鈕被稱爲選擇器

-(void) displayCommentView 
    CommentViewController *commentViewController = [[CommentViewController alloc] initWithPostId:self.postId groupId:self.groupId]; 

    UINavigationController *navigationController = [[UINavigationController alloc] 
                initWithRootViewController:commentViewController]; 
    [self presentModalViewController:navigationController animated:YES]; 
    [navigationController release]; 
    [commentViewController release]; 
+0

由於某些原因,它不會在文本域事件中工作 – bluezald

相關問題