我想創建一個撥號盤,並且當點擊dial.i中的圖像時想獲取圖像的標籤,但嘗試了很多,但是我沒有「噸得到it.see下面如何檢測圖像子視圖的標籤,當我在旋轉的uiview中觸摸圖像時
- (void) drawWheel {
container = [[UIView alloc] initWithFrame:self.frame];
CGFloat angleSize = 2*M_PI/numberOfSections;
for (int i = 0; i < numberOfSections; i++) {
UIImageView *im = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"segment.png"]];
im.layer.anchorPoint = CGPointMake(1.0f, 0.5f);
im.layer.position = CGPointMake(container.bounds.size.width/2.0-container.frame.origin.x,
container.bounds.size.height/2.0-container.frame.origin.y);
im.transform = CGAffineTransformMakeRotation(angleSize*i);
im.alpha = minAlphavalue;
im.tag = i;
if (i == 0) {
im.alpha = maxAlphavalue;
}
cloveImage = [[UIImageView alloc] initWithFrame:CGRectMake(12, 15, 40, 40)];
cloveImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon%i.png", i]];
cloveImage.tag=i;
[im addSubview:cloveImage];
代碼}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
//我想cloveImage.tag當我點擊了imageview的
}
所以我的問題是如何檢測圖像的標籤在旋轉的車輪,當我摸到
特定圖像?
我試過太多,但方法willnot得到 – Vivek2015
讓我看看你的方法.. – AppleDelegate