startuprob
startuprob

Reputation: 1915

How to create a spinnable image for iPhone/iPad?

I am really at a loss for starting this project. I have an object that I want the user to be able to flick their finger and spin on an iPhone/iPad app that I am creating, but don't really know how to do it. As an example of what I am talking about, the Elements app allows you to "spin" the element. Any thoughts?

Upvotes: 0

Views: 434

Answers (2)

occulus
occulus

Reputation: 17014

The Elements uses OpenGL to present a 3D model. I suggest you look into OpenGL if you want a similar effect.

http://maniacdev.com/2009/04/8-great-resources-for-learning-iphone-opengl-es/

In the case of The Elements, it's not an image you're spinning, it's a 3D model.

Upvotes: 1

levous
levous

Reputation: 932

This will spin something in a circle. However, you'll have to handle your touch events for the flick

Where angle is a CGFloat and theView is a UIView

-(void)spinViewABit
{
  angle += 0.01;
  if (angle > 6.283) { 
    angle = 0;
  }

  CGAffineTransform transform=CGAffineTransformMakeRotation(angle);
  theView.transform = transform;
}

Upvotes: 0

Related Questions