TTMessageController 无法将其 textEditor 设置为firstResponder

发布于 2024-11-29 00:05:07 字数 606 浏览 0 评论 0原文

我有一个 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 等方法中强制成为FirstResponder 其 textEditor,仍然无法实现 出现。

希望得到答复,确实需要帮助,谢谢

I have a subclass of TTMessageController which is (CommentViewController) and I have the following mapping

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

When I call CommentViewController from my PostDetailsViewController class, its keyboard does not appear, but when I call it from my other view controller class its keyboard appears,

even if I try to force to becomeFirstResponder its textEditor in all viewWillAppear, viewDidLoad and etc. methods of my CommentViewController, still I cannot make it appear.

hope for a reply, really need help with this, Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寒尘 2024-12-06 00:05:07

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

the problem here is, i call the method when user begins edit in my textfield, instead of textfield i change it to a button with a selector to call and display the CommentViewController,

Instead of this

- (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]; 
}

I made a method to be called by a button as a selector

-(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]; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文