Skip to content

Is it good idea to change layout/appearance attributes in -drawRect? #157

@grigorye

Description

@grigorye

- (void)drawButton {

I'm trying to integrate DLRadioButton in our project and I'm adding snapshot tests for a view containing the button. I face the issue with snapshot not accounting the radio icon and etc.. After studying the sources I believe that the current implementation of -drawButton: just schedules the changes in the appearance/layout vs. result in the real icon rendered, that sounds like misuse of API (-drawRect:).

I tried to solve the issue by moving the code to -layoutSubviews and that kind of eliminated the problem with snapshot/made the whole thing behave as expected. I had to disable check for accessibilityIdentifier though - if somebody could clarify the rationale for the check that would be great.

Would you mind PR addressing this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions