我想在iPhone应用程序中点击可点击的饼图。我有一个图像,但我想知道如何使用UIImageView或任何其他组件指定可点击区域。我不想使用HTML图像映射。
答案 0 :(得分:1)
一个简单的解决方案是在图像上添加透明按钮。
UIButton *transparantButton = [UIButton buttonWithType:UIButtonTypeCustom];
transparantButton.frame = CGRectMake(100, 100, 50, 50);
[transparantButton addTarget:self action:@selector(clicked) forControlEvents:UIControlEventTouchUpInside];
[imageView addSubview:transparantButton];
答案 1 :(得分:0)
您可以尝试将自定义按钮放在您想要的区域上或检测触摸,并根据触摸位置执行必要的操作。
注意:如果此类可点击区域的数量很少,则使用按钮的方法会更好。
答案 2 :(得分:-2)
您可以使用jquery mobilymap为{i>创建图像映射:Jquery Map