(lldb) po [self.searchBar recursiveDescription]
<UISearchBar: 0x7ff35854f370; frame = ( ; ); text = 'p'; opaque = NO; gestureRecognizers = <NSArray: 0x7ff358550380>; layer = <CALayer: 0x7ff35854f890>>
| <UIView: 0x7ff35854fb90; frame = ( ; ); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x7ff35854fd00>>
| | <UISearchBarBackground: 0x7ff3585504d0; frame = ( ; ); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7ff358550950>>
| | <UISearchBarTextField: 0x7ff358551480; frame = ( ; ); text = 'p'; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x7ff358553e80>; layer = <CALayer: 0x7ff358551850>>
| | | <_UISearchBarSearchFieldBackgroundView: 0x7ff358785900; frame = ( ; ); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x7ff3587432a0>>
| | | <UIButton: 0x7ff358562e00; frame = (270.5 4.5; ); opaque = NO; layer = <CALayer: 0x7ff358562d00>>
| | | | <UIImageView: 0x7ff358493320; frame = (2.5 2.5; ); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7ff3584934d0>>
| | | <UIImageView: 0x7ff358784340; frame = ( 7.5; ); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7ff35877b4d0>>
| | | <UITextFieldLabel: 0x7ff3585524b0; frame = (- -; ); text = 'p'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7ff3585526c0>>
| | <UINavigationButton: 0x7ff358470020; frame = ( ; ); opaque = NO; layer = <CALayer: 0x7ff35840ad70>>
| | | <UIButtonLabel: 0x7ff35a82e430; frame = ( ; 20.5); text = 'Cancel'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7ff35a82e6e0>> //UINavigationButton是私有类,可以使用NSClassFromString转换过来
for (UIView *view in [[[self.searchBar subviews] objectAtIndex:] subviews]) { if ([view isKindOfClass:[NSClassFromString(@"UINavigationButton") class]]) {
UIButton *btn = (UIButton *)view;
btn.enabled = YES;
} }

查看iOS视图层级并修改UIsearchBar的cancel按钮不失去作用的更多相关文章

  1. 修改UISearchBar的Cancel按钮为中文等本地化问题

    正确方法: 1:创建本地化strings. InfoPlist.strings 2:对InfoPlist.strings添加本地化语言. 即可. 只要添加文件, 系统会根据语言来调整显示文字 常见的搜 ...

  2. iOS7修改UISearchBar的Cancel按钮的颜色和文字

    两行代码搞定: [[UIBarButtonItem appearanceWhenContainedIn: [UISearchBar class], nil] setTintColor:[UIColor ...

  3. 如何将UISearchBar上"Cancel"按钮改为”取消“?

    别说话,直接上代码 for (id obj in [searchBar subviews]) {        if ([obj isKindOfClass:[UIView class]]) {    ...

  4. iOS 视图控制器转场详解

    iOS 视图控制器转场详解 前言的前言 唐巧前辈在微信公众号「iOSDevTips」以及其博客上推送了我的文章后,我的 Github 各项指标有了大幅度的增长,多谢唐巧前辈的推荐.有些人问我相关的问题 ...

  5. View Programming Guide for iOS ---- iOS 视图编程指南(四)---Views

    Views Because view objects are the main way your application interacts with the user, they have many ...

  6. View Programming Guide for iOS ---- iOS 视图编程指南(一)

    Next About Windows and Views 关于窗口和视图 In iOS, you use windows and views to present your application’s ...

  7. 浏览器视图层级中的“根”:<html>和<body>的属性研究

    做前端开发的同学都会知道,每一个UI系统(比如IOS或Android)中都会有一个view hierarchy(视图层级)的概念,即所有的可视元素(大到一个页面,小到一个button)都在一个树形结构 ...

  8. iOS运用runtime全局修改UILabel的默认字体

    iOS运用runtime全局修改UILabel的默认字体 一.需求背景介绍 在项目比较成熟的基础上,遇到了这样一个需求,应用中需要引入新的字体,需要更换所有Label的默认字体,但是同时,对于一些特殊 ...

  9. iOS 视图控制器 (内容根据iOS编程编写)

    视图控制器是  UIViewController 类或其子类对象.每个视图控制器都负责管理一个视图层次结构,包括创建视图层级结构中的视图并处理相关用户事件,以及将整个视图层次结构添加到应用窗口. 创建 ...

随机推荐

  1. oracle imp导入库到指定表空间

    1.创建表空间 create tablespace example_tablespace datafile 'e:\****.dbf' size 10m reuse autoextend on nex ...

  2. PHP+jQuery 注册模块的改进之二:激活链接的URL设置与有效期

    接<PHP+jQuery 注册模块的改进之一>继续修改: ①在注册成功后返回登录邮件页面( maillogin.php ),在页面中用户可以点击链接跳转到自己注册邮箱的登录页面,可以再次发 ...

  3. UIbutton 圆角和边线

    #define WhiteColor [UIColor whiteColor]#define YellowColor  Color_RGB(253,131,42,1)//主题黄#define Font ...

  4. PHP IDE phpstorm 常用快捷键

    PHP IDE phpstorm 常用快捷键 投稿:junjie 字体:[增加 减小] 类型:转载   这篇文章主要介绍了PHP IDE phpstorm 常用快捷键,本文分别列出了mac系统和Win ...

  5. Visual Studio快捷键不能使用解决办法

    环境: Visual Studio 2010,windows 7 使用Visual Studio查找变量或方法时常用到[定位到]功能 但该功能的快捷键却不能使用,解决办法如下所示: 1.工具--> ...

  6. LENGTH() CHAR_LENGTH()

    http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_length LENGTH(str) Returns the ...

  7. 【ECshop错误集锦】解决ECShop发送邮件提示:Error: need RCPT command

    ECShop发送邮件报错Error: need RCPT command,经检测,邮件服务器返回的真实错误是501 mail from address must be same as authoriz ...

  8. android硬件调试之无法识别android设备解决办法

    DDMS 中无法识别华为荣耀六手机,  用豌豆荚开始显示无法连接,  用豌豆荚安装完驱动后,就可以连接了 http://www.zhihu.com/question/30588024 http://w ...

  9. wampserver

  10. python : dictionary changed size during iteration

    1. 错误方式 #这里初始化一个dict >>> d = {'a':1, 'b':0, 'c':1, 'd':0} #本意是遍历dict,发现元素的值是0的话,就删掉 >> ...