【发布时间】:2012-02-10 06:24:50
【问题描述】:
开发 iphone 应用程序,我使用了 UIImageview 并设置了不规则形状的图像
// uiimageview type shutter
shutter = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,32.5)];
//setting image on shutter
UIImage* shutterimg = [UIImage imageNamed:@"trayshutter.png"];
[shutter setImage:shutterimg];
// User interaction
shutter.userInteractionEnabled=YES;
我使用 touchesbegan 进行接触
一切都很好,但问题是我还在 imageview 的 CGRectMake(即 0,0,320,32.5)占用的所有矩形区域中获得事件,而我只需要图像上的事件(形状为 - ---|||||-----)。
如何确保我只在图像上而不是在 cgrectmake 覆盖的其余区域上获得事件?
【问题讨论】:
标签: iphone uiimageview uiimage touchesbegan user-interaction