chuxpp
chuxpp

Reputation: 13

Move Images in the same axis Xcode-IOS

I'm trying to move an image on the same axis,according to data obtained by the device I want the image to move up or down while keeping the center on the Y axis. Thanks.

Upvotes: 0

Views: 720

Answers (2)

chuxpp
chuxpp

Reputation: 13

I used this and it worked:

imattitude.transform = CGAffineTransformTranslate(imattitude.transform, 0, accel[2]*75);

Where 0 is the value in x axis to move and accel[2]*75 is the value in axis y for move.

Upvotes: 1

nycynik
nycynik

Reputation: 7541

Here is a tutorial to help you: http://www.codeproject.com/Articles/93563/Introduction-to-iOS-Graphics-APIs-Part-1

The big change is: CGContextMoveToPoint(context,fromPoint.x , fromPoint.y);

Do not change both, only change one, and used a fixed Y. CGContextMoveToPoint(context,fromPoint.x , 160);

Upvotes: 0

Related Questions