zoukankan      html  css  js  c++  java
  • 修改searchBar的返回按钮的显示文字

    #pragma mark 搜索框的代理方法,搜索输入框获得焦点(聚焦)

    - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar

    {

        [searchBar setShowsCancelButton:YES animated:YES];

     

        for(id cc in [searchBar.subviews[0] subviews])

        {

            if([cc isKindOfClass:[UIButton class]])

            {

                UIButton *cancelButton = (UIButton *)cc;

                [cancelButton setTitle:@"取消" forState:UIControlStateNormal];

                [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

            // 修改文字颜色
                [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
                 
                // 修改按钮背景
                [cancelButton setBackgroundImage:[UIImage resizedImage:@"login_btn_login.png"] forState:UIControlStateNormal];
                [cancelButton setBackgroundImage:nil forState:UIControlStateHighlighted];

            }

        }

    }

  • 相关阅读:
    雅虎35条优化黄金守则
    安装入门
    NPOI 2.0 Excel读取显示
    STL算法
    MVVM框架avalon在兼容旧式IE
    Asp.Net MVC3.0网站统计登录认证的在线人数
    Windows Server 服务器安全配置
    SignalR的服务器广播
    angularjs + seajs构建Web Form3
    MVC应用程序显示上传的图片
  • 原文地址:https://www.cnblogs.com/zj901203/p/5344778.html
Copyright © 2011-2022 走看看