TTMessageController无法将其textEditor设置为firstResponder

时间:2011-08-12 07:51:33

标签: iphone three20

我有一个TTMessageController的子类,它是(CommentViewController),我有以下映射

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

当我从PostDetailsViewController类调用CommentViewController 时,它的键盘没有显示,但是当我从其他视图控制器类调用它时键盘出现

即使我尝试在我的CommentViewController的所有viewWillAppear,viewDidLoad等方法中强制成为其第一个应用程序的textEditor,仍然无法让它出现。

希望得到答复,真的需要帮助,谢谢

1 个答案:

答案 0 :(得分:0)

这里的问题是,当用户在我的文本字段中开始编辑时调用该方法,而不是textfield我将其更改为带有选择器的按钮,以调用并显示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];