How to override the cancel button in the UISearchBar

后端 未结 3 2041
难免孤独
难免孤独 2021-01-20 04:32

I am currently using the following method to stop the cancel button item from showing up in the search bar. I have a custom UIButton that I would like to use in

3条回答
  •  春和景丽
    2021-01-20 05:00

    for (UIView *possibleButton in searchBar.subviews)
    {  
        if ([possibleButton isKindOfClass:[UIButton class]])  
        {  
            UIButton *cancelButton = (UIButton*)possibleButton;  
            cancelButton.enabled = YES;  
            break;
        }    
    }
    

    one go through this link UISearchBar disable auto disable of cancel button

提交回复
热议问题