如何检测ARKit坐标视图中的触摸?
我当前的代码是这样的:
UIButton *testButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
testButton.frame = CGRectMake(0, 0, 100, 100);
[testButton setTitle:@"HELLOHELLOHELLO" forState:UIControlStateNormal];
[testButton addTarget:self action:@selector(pushPhoneDetailController:) forControlEvents:UIControlEventTouchUpInside];
testButton.tag = toPutTag;
[tempView addSubview:testButton];
但我没有收到任何按钮上的触摸。有什么想法吗?
My current code is as such:
UIButton *testButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
testButton.frame = CGRectMake(0, 0, 100, 100);
[testButton setTitle:@"HELLOHELLOHELLO" forState:UIControlStateNormal];
[testButton addTarget:self action:@selector(pushPhoneDetailController:) forControlEvents:UIControlEventTouchUpInside];
testButton.tag = toPutTag;
[tempView addSubview:testButton];
But I am not receiving any touches on the buttons. Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我将在这里回答我自己的赏金。
这个精彩的框架现已由 Niels Hansen 更新:
https://github.com/nielswh/iPhone- AR-Toolkit
最新的更新包含许多功能,其中包括单击特定坐标的功能。我会推荐每个增强现实极客查看 iPhone-AR-Toolkit!
I'll answer to my own bounty here.
This wonderful framework has now been updated by Niels Hansen:
https://github.com/nielswh/iPhone-AR-Toolkit
The latest update contains, among many thing, the ability to click on specific coordinates. I'll recommend every Augmented Reality geek to check out the iPhone-AR-Toolkit!
我对这段代码不太了解,但是......你尝试过吗:
?
I don't know so much about this code but... did you try:
?
您可以添加 UITapGestureRecognizer,通过适当的选择器初始化它,并将此手势分配给所需的 UIControl。
我已经通过增强现实应用程序解决了同样的问题。希望,它也能帮助你。
You can add UITapGestureRecognizer, initialize it by a proper selector and assign this gesture to desired UIControl.
I have done for the same problem with Augmented Reality Application. Hope, it will help you out too.