0
我與ARKit API玩弄......我想在右邊出現由下面的代碼在應用程序代理產生的畫面上的方塊中添加自定義的UIButton:在ARKit自定義的UIButton編程
#define BOX_WIDTH 350
#define BOX_HEIGHT 150
- (UIView *)viewForCoordinate:(ARCoordinate *)coordinate {
CGRect theFrame = CGRectMake(0, 0, BOX_WIDTH, BOX_HEIGHT);
UIView *tempView = [[UIView alloc] initWithFrame:theFrame];
//tempView.backgroundColor = [UIColor colorWithWhite:.5 alpha:.3];
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, BOX_WIDTH, 20.0)];
titleLabel.backgroundColor = [UIColor colorWithWhite:.3 alpha:.8];
titleLabel.textColor = [UIColor whiteColor];
titleLabel.textAlignment = UITextAlignmentCenter;
titleLabel.text = coordinate.title;
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(BOX_WIDTH/2.0 - titleLabel.frame.size.width/2.0 - 4.0, 0, titleLabel.frame.size.width + 8.0, titleLabel.frame.size.height + 8.0);
UIImageView *pointView = [[UIImageView alloc] initWithFrame:CGRectZero];
pointView.image = [UIImage imageNamed:@"location.png"];
pointView.frame = CGRectMake((int)(BOX_WIDTH/2.0 - pointView.image.size.width/2.0), (int)(BOX_HEIGHT/2.0 - pointView.image.size.height/2.0), pointView.image.size.width, pointView.image.size.height);
[tempView addSubview:titleLabel];
[tempView addSubview:pointView];
[titleLabel release];
[pointView release];
return [tempView autorelease];
}
我該如何解決這個問題?請幫忙 !
對此有什麼好運?我在那個tempView上添加了一個UIButton,但是當我嘗試點擊它時,它不會執行任何操作。 – Frank 2010-10-15 19:27:20
嗨,即時通訊只是想知道 - 你設法解僱的觀點?如果是的話,你可以分享嗎?我自己有一些問題 – 2011-09-02 14:08:13