修改searchbar 取消 字体 颜色

    UIButton *cancelButton;  
    UIView *topView = self.searchDisplayController.searchBar.subviews[0];  
    for (UIView *subView in topView.subviews) {  
        if ([subView isKindOfClass:NSClassFromString(@"UINavigationButton")]) {  
            cancelButton = (UIButton*)subView;  
        }  
    }  
    if (cancelButton) {  
        //Set the new title of the cancel button  
        [cancelButton setTitle:@"取消" forState:UIControlStateNormal];  
        [cancelButton setTitleColor:[UIColor colorWithRed:53.f/255.f green:114.f/255.f blue:255.f/255.f alpha:1.0] forState:UIControlStateNormal];  
        cancelButton.titleLabel.font = [UIFont fontWithName:@"Heiti SC" size:15];  
    }  

 

posted @ 2016-01-22 13:41  frounk  阅读(330)  评论(0)    收藏  举报