Skip to content

valueForKey: @"_clearButton" #43

@mahmutsahinn

Description

@mahmutsahinn

Hi,

I have a US2ValidatorTextField and i want to change clear button image.

@Property(nonatomic,strong) US2ValidatorTextField *txtSearch;

in viewDidload method;

UIButton *clearButton = [self.txtSearch valueForKey:@"_clearButton"]; [clearButton setImage:[UIImage imageNamed:@"icon_textbox_close"] forState:UIControlStateNormal]; [clearButton setImage:[UIImage imageNamed:@"icon_textbox_close"] forState:UIControlStateHighlighted];

This code works fine but sometimes it gives crash for valueforundefined key.
I had to get into try catch block. I dont understand root causes this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions