-1

I am creating a word search game for the iPhone and am having trouble figuring out what is the best approach to take for the main component of the game (the word search puzzle).

I am currently using a collection view to display the puzzle. However I am having trouble figuring out how to track the users touch on the collection view to highlight letter as they slide their finger across the puzzle.

Iv looked into collection views's selection and highlight features but they don't seem to provide the functionality that I need.

So basically my question are as follows: Is a collection view the best approach for this type of game (word search)? If it is, then how do I go about tracking the user input to highlight and return the cells they slide their fingers over? And if it is not the best approach what are some other options, that make it easier to track users input on a grid like display?

I tired posting images of what I am talking about but can't due so, so hopefully my problem is clear, if not please let me know and I will try to be more specific.

Thank you in advance for any advice and suggestions.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
Felix Hidalgo
  • 25
  • 1
  • 2

2 Answers2

0

A way to go about this would be to add a pan gesture recognizer to the collection view. Then, you can use indexPathForItemAtPoint: and cellForItemAtIndexPath: to get the correct cell as the user pans. You can then do whatever you want with the individual cells.

Dimitar08
  • 450
  • 7
  • 15
  • Thank for the feedback, has been really helpful and I have been able to make some progress taking this approach. Do you know of anyway that I can limit a Pan gestures direction? Right now I can pan over the entire grid and it highlights all the cells, but I need it to be limited to certain directions (horizontal, vertical, diagonal) as those are the directions in which words will be placed on the puzzle. Any feedback or resource would be greatly appreciated. Thanks again! – Felix Hidalgo Mar 18 '13 at 13:48
  • As soon the user selects two cells, you can add some logic that will only highlight cells that are on the same row (horizontal panning) or in the same column (vertical panning) – Dimitar08 Mar 18 '13 at 16:25
  • Ok, I figured as much, just wanted to know if there were already some methods that enforced this kind of behavior. Thank you again, I posted this question on a bunch of forms and you were the only one with valuable feed back. – Felix Hidalgo Mar 18 '13 at 18:18
0

There is a great SDK for iOS called HeatMap. You can get more info HERE. I have read lots of good stuff about the developer and the service. Lets you track touch events on selective views.

Here is a screenshot from the demo on that site:

HeapMap

LJ Wilson
  • 14,445
  • 5
  • 38
  • 62