Posts

Showing posts from December, 2009

Rotating an Image on a View by touching it : the Objective C way

What? You want to rotate an Image by touching it? iPhone? iPod touch application? Have googled day and night? Got your spine aching, eyes red? Calm down, help is on its way. But I don't promise its bullet proof, but still, at least its working to some extent, and its done my way, my recipe which I tried over and over again so that it could taste the way it tastes now. As said earlier, it's not perfect, but it serves the main purpose, that is rotating an image around it's center by touching it, to some extent. Scenario: I had a View, UIView object. I called it "canvas". I had another view, UIImageView. I called it "imgobj". I was required to rotate it around it's center by touching. Concept: This is only possible when I know the angle between the straight lines made by by the points, center C (cx, cy) and where I touched P1 (x1, y1) and center (cx, cy) and where I took off my finger from the screen (x2, y2). So basically if we can get the difference o