0
我有5个图像在UIimageview中显示并逐个显示数组中的5个图像。我想获取特定图像上的图像数据点击,并显示一些数据在webview中使用触摸事件。我没有得到imagedata.My代码是在这里Iphone,从Uiimageview获取图像数据
imgarr->包括5个不同的图像
obj=[touches anyObject];
CGPoint point=[obj locationInView:self.view];
touchLocation=point;
if(CGRectContainsPoint([imgview frame],point))
{
//cloud.center=touchLocation;
NSData *imgData = UIImageJPEGRepresentation(imgview.image, 9.0);
UIImage *img = [UIImage imageWithData:imgData];
NSLog(@"selimg=%@",img);
for(int i=0;i<[imgarr count];i++)
{
UIImage *arr=[imgarr objectAtIndex:i];
NSData *arrdata=UIImageJPEGRepresentation(arr,9.0);
if(arrdata==imgData)
NSLog(@"True");
}
}
帮助我..
rckoenes,感谢您的回复,也没有显示在控制台的NSLog 。 – user1497665 2012-07-09 13:34:24