carekit-apple / CareKit

CareKit is an open source software framework for creating apps that help people better understand and manage their health.
https://www.researchandcare.org
Other
2.41k stars 444 forks source link

Ability to hide detail disclosure in header views #643

Closed williamkey123 closed 2 years ago

williamkey123 commented 2 years ago

I'm subclassing OCKGridTaskViewController and I don't want there to be any detail view. I've followed @gavirawson-apple 's recommendation in issue 401 to override the detail behavior, and that works great. But the problem is that there is still a detail disclosure arrow on the header.

Screen Shot 2022-02-23 at 10 38 42 AM

Tantalizingly, OCKHeaderView has a property for showsDetailDisclosure, but it's a let constant and I can't find a way to edit this. It seems like this functionality should be easily customizable... any advice?

williamkey123 commented 2 years ago

Also... why are these items disclosure indicators in the first place? Disclosure indicators should be used to indicate an action that will push a new item onto a navigation stack, not present a view modally. This should be an info button.

grawson commented 2 years ago

You've found the right spot, there is no current way to set showsDetailDisclosure. You can hide it by accessing the image directly:

headerView.detailDisclosureImage?.isHidden = true

@williamkey123 you can access that same property to change it to an info button if needed.

detailDisclosureImage?.image = someNewImage
williamkey123 commented 2 years ago

Awesome, thanks @grawson !