ojo / ios

:iphone:
0 stars 0 forks source link

Stations: highlight view when station is selected #19

Closed btc closed 7 years ago

btc commented 7 years ago

This also needs to be done for the News Feed items. However, that's a separate issue.

btc commented 7 years ago

@bsuvorov Do you have any suggestions for highlighting the view and it's subviews when a station is being touched on this screen:

image

btc commented 7 years ago

I'm overriding touchesBegan and touchesEnded (not sure if that's the right thing to do) and changing the image's background color (but I actually want to change the foreground [doesn't work]).

bsuvorov commented 7 years ago

Collection view delegate should have shouldHighlight / didHighlight methods that you could use for that purpose. On Mon, Jan 2, 2017 at 2:14 PM Brian Tiger Chow notifications@github.com wrote:

Closed #19 https://github.com/ojo/ios/issues/19.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ojo/ios/issues/19#event-909280775, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdasDW-cmpw6oS4hx2RdIq5UtTwOIIHks5rOXatgaJpZM4LXvDD .

btc commented 7 years ago

Here, I sacrificed some simplicity for the sake of usability.

Since we're going to have three radio stations for a while, I opted to lay them out manually, without a CollectionView. That way, I can ensure they all fit onto the screen perfectly. (Perhaps that was possible with the collectionView, but I didn't see the path forward).

So, at runtime, we pick a ViewController implementation based on the number of stations. If there are exactly three, we lay them out manually. Otherwise, we use the collection view.

Right now I'm laying them out manually. Each station's view is a subclass of UIView with an image, text, and gesture recognizer.

So, in order to highlight this implementation, I can't use shouldHighlight/didHighlight.

Manual layout implementation: https://github.com/ojo/ios/blob/master/ojo/Stations3ViewController.swift