How do I rotate the ImageView ... i'm trying to use landscape mode, and have a problem with accelerometer moving the image ... Because when I work in portrait mode the x of accelerometer is the same as the x of the image ... But when I work landscape, the x of accelerometer is the y of the image, because the ImageView autorotates with the parent View. When I rotate the image with CGAffineTransformMakeRotation(M_PI/2), it rotates only the image in it's ImageView... and the x,y sides stays untouched ... Is there any way to make own class which will extend UIImageView where I will swap the x,y sides of a UIImageView ? Or is there some way to rotate the UIImageView, and not only the image in it?
float degree = atan2(accelX, accelY) * 180 / 3.14159;
其中accelX和accelY是来自加速度计的值,请使用度数并旋转ImageView。
Try to convert points depending on orientation...
if( orientation == LANDSCAPE )
{
CGPoint temp;
temp = [touch locationInView:self];
touchPoint.x = temp.y;
touchPoint.y = 320 - temp.x;
}
The above code convert points from portrait to landscape...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.