Puzzle

For our latest project (Rupert Explores), they wanted to add a small puzzle game into the app.  As always, I started looking in Github for possible candidates, and stumbled upon SlidingPuzzleBoard, which seemed perfect for the job.  After playing with it for half an hour, I succeeded in integrating it into the app.  This is how it looks like:

Integrating the code was pretty easy.  Below's the coding I did in order to add the puzzle into Rupert Explores:

[objc] - (void)viewDidLoad { [super viewDidLoad]; if (!puzzleView) puzzleView = [[IAPuzzleBoardView alloc] initWithImage:[UIImage imageNamed:@"PuzzelRaket.jpg"] andSize:3 withFrame:CGRectMake(388, 160, 512, 512)]; } [/objc]
And the result looks astonishing. If you want to get notified whenever the puzzle is finished, you just need to implement the delegate do something with the puzzleFinished callback. This might look like this: [objc] - (void)viewDidLoad { [super viewDidLoad]; if (!puzzleView) { puzzleView = [[IAPuzzleBoardView alloc] initWithImage:[UIImage imageNamed:@"PuzzelRaket.jpg"] andSize:3 withFrame:CGRectMake(388, 160, 512, 512)]; puzzleView.delegate = self; } } #pragma mark IAPuzzleBoardViewDelegate - (void)puzzleFinished { NSLog(@"Puzzle finished!"); } [/objc]