2011-06-27 48 views
4

我當前的代碼是這樣的:如何檢測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]; 

但我沒有收到上的按鈕任何接觸。任何想法?

+0

我現在有同樣的問題,你有沒有找到解決辦法? –

回答

2

我會在這裏回答我自己的賞金。

這個奇妙的框架現在已經更新由尼爾斯·漢森:

https://github.com/nielswh/iPhone-AR-Toolkit

最新更新包含許多事情當中,能夠點擊的具體座標。我會推薦每個增強現實極客來檢查iPhone-AR-Toolkit!

2

我不知道這麼多關於這個代碼,但是...你試試:

[tempView bringSubviewToFront:testButton]; 

1

您可以添加UITapGestureRecognizer,通過適當的選擇器對其進行初始化,並將此手勢分配給所需的UIControl。

UIImageView *myImgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:img]]; 
    myImgView.frame = CGRectMake(0, 10, 230, 145);   
    [myImgView addGestureRecognizer:tap]; 
    [tap release]; 
    [self.view addSubView:frame]; 

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped:)]; 
    [myImgView addGestureRecognizer:tap]; 
    [tap release]; 

我已經爲增強現實應用程序的相同問題做了。希望,它也會幫助你。