Search code examples
iosswiftuitableviewcustom-cell

Change custom cell content view color


I added a change theme button in my main view controller where I have a tiny table view. I can change every color except a table view cell's Content View background color, and I can't access it outside cellForRowAt.

What should I do? Is there anyway to trigger a function from my custom Cell to change the color?


Solution

  • You can achieve this by implementing delegate, if you have custom cell class and access the delegate method to change content view color.