New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: TableCell highlighting #162
Comments
Contemplating this one a bit now. If we hook into it with an action similar to SelectionAction you lose a bit of the type safety in that your view would come through as a UIView and would require a force/optional cast to the expected type before digging into the view hierarchy to manipulate backgroundColor. I wonder if we should change the signature of the update function: to be more along the lines of UpdateContext could then be something along the lines of
FunctionalTableData Delegate/Datasource's would then, on highlight/select/etc calls trigger this. I think this could be introduced in a backwards compatible way as well. @runmad thoughts? |
I really like that suggestion! With the actions, I definitely feel like we're missing parts of what comes for free with I think starting with selection/highlighting seems appropriate for now and more closely resemble Is this somewhat related to #54? |
The highlight delegate methods are:
returning false on the
And yeah, this could be somewhat related to #54 as it could be one of the cases used in the |
That's true. I suppose this ties in a bit with functionality in |
The Context change will be a good addition, but complexity for implementing a cell will skyrocket. Now we are dealing with many more "states". I would be inclined for some magic here, an UIView extension for This will have to work with |
@g-Off @raulriera any thoughts on this? |
Looks like iOS 13 changes the way highlighting works, which affects |
How did they change? |
UITableViewCell
s have a function built in: setHighlighted(_ highlighted: Bool, animated: Bool)`, which allows you to manipulate any subviews as needed when the user touches down on a cell.With FunctionalTableData, this callback does not occur for free. There's currently no way in a
HostCell
implementation to override this callback.The most common use case is when you have a
UIView
orUIImageView
with an opaque background color. On highlight,UITableViewCell
will automatically remove the background color for any subviews to ensure the selection color is visible. In the cases where you want to retain the background color of any subviews during selection and highlighting with aUITableViewCell
you'd simply overridesetHighlighted
and ensure the background is set for either state.CellActions
currently provides some state overriding, such asSelectionState
, however none exist for a highlighted state.I reckon something like the following would be good:
with
At the same time, I do see two callbacks for selection/deselection, so highlighting could have the same two, or perhaps selection could be reconfigured to one callback to have the two be the same:
The text was updated successfully, but these errors were encountered: