Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li>Not really, in my experience.</li> <li>From the way you've set up your views, there would seem to be a much more efficient way to determine which one was tapped:</li> </ol> <p><code><pre></p> <pre><code> //In your init method, make sure each tile doesn't respond to clicks on its own ... tile.userInteractionEnabled = NO; ... - (void) touchesMoved: (NSSet *)touches withEvent:(UIEvent *)event { CGPoint tappedPt = [[touches anyObject] locationInView: self]; int xPos = tappedPt.x / (TILE_SPACING + TILE_PADDING); int yPos = tappedPt.y / (TILE_SPACING + TILE_PADDING); int tilesAcross = (self.bounds.size.width / (TILE_SPACING + TILE_PADDING)); int index = xPos + yPos * tilesAcross; if (index &lt; self.subviews.count) { UIView *tappedTile = [self.subviews objectAtIndex: index]; tappedTile.hidden = YES; } } </code></pre> <p></pre></code></p> <ol start="3"> <li>You need to more clearly decide what should happen in your parent, and what should happen in each tile. You mentioned above that you wanted the tiles to receive touchesBegan events, but you didn't include any code for this. As you presented this, you should probably think about using layers instead of views (if you're not doing any tile-specific event handling). What you've got here can all be done with event tracking within the parent. Keep in mind that if you have TOO many views (or layers), it's gonna get slow. We tried grids of 15x15 in Crosswords, and while it was okay for some things, eventually we gave up on the grid-of-layers approach. </li> </ol> <p>(Not sure why the numbering restarted with 1 here...)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload