iOS - Customizing Cancel button of UISearchBar

后端 未结 4 2289
我在风中等你
我在风中等你 2020-12-14 22:16

In my iOS5 iPhone application, i\'m setting the tint color of search bar using following code:

searchBar.tintColor = UIColorMake(@\"#EFEFEF\");
4条回答
  •  情深已故
    2020-12-14 22:57

    This method works in IOS7

    for (UIView *view in searchBar.subviews)
        {
            for (id subview in view.subviews)
            {
                if ( [subview isKindOfClass:[UIButton class]] )
                {
                    // customize cancel button
                    UIButton* cancelBtn = (UIButton*)subview;
                    [cancelBtn setEnabled:YES];
                    break;
                }
            }
        }
    

    Check this https://stackoverflow.com/a/18150826/1767686

提交回复
热议问题