russell
russell

Reputation: 3766

how to swap images using Cocoa Touch

I am trying to build 15-puzzle game.

Here I need to swap a blank image with a clicked on image. I would like to know how to swap these images.

I have stored the co-ordinates of the two images,but don't know the format to identify the blank image and then set its origin to clicked image.

Upvotes: 0

Views: 543

Answers (1)

Peter Hosey
Peter Hosey

Reputation: 96323

Present each tile as a CALayer. To swap two tiles, set each layer's position to the other's position.

Upvotes: 2

Related Questions