uchicago-mobi / MPCS51030-2019-Spring-Forum

This repository will contain code examples and discussion topics for the winter 2019 quarter.
1 stars 1 forks source link

Using outlet collections #33

Closed westminsterabi closed 5 years ago

westminsterabi commented 5 years ago

I'm having a little trouble with the outlet collections, because my squares only seem to ever drop on the center ones, no matter where I put the piece. I'm printing the indices of whichever square has been recognized and even though I have all 9 in the array, the only indices that ever get printed are 0, 1, and 2, and the pieces only ever snap into place over the center column. I don't know if this has to do with the math (which is also a struggle but I've read #25 and I'm working on it) or if there's some other problem with the way I'm approaching things.

hbennett766 commented 5 years ago

This has to do with the math. Your grid squares are contained within stack views, which are contained within a bigger stack view, which is contained within the main view, correct?

Check what the system says the frame of each square is. There's probably a subview discrepancy that's making your basic intersects check not work properly. You'll have to figure out the addition needed to get the frame of each square in relation to the main view, so the game piece and the squares are on the same "plane", if you will.

westminsterabi commented 5 years ago

Oh I see, because they're all centered within their stack views