查看iOS视图层级并修改UIsearchBar的cancel按钮不失去作用
(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按钮不失去作用的更多相关文章
- 修改UISearchBar的Cancel按钮为中文等本地化问题
正确方法: 1:创建本地化strings. InfoPlist.strings 2:对InfoPlist.strings添加本地化语言. 即可. 只要添加文件, 系统会根据语言来调整显示文字 常见的搜 ...
- iOS7修改UISearchBar的Cancel按钮的颜色和文字
两行代码搞定: [[UIBarButtonItem appearanceWhenContainedIn: [UISearchBar class], nil] setTintColor:[UIColor ...
- 如何将UISearchBar上"Cancel"按钮改为”取消“?
别说话,直接上代码 for (id obj in [searchBar subviews]) { if ([obj isKindOfClass:[UIView class]]) { ...
- iOS 视图控制器转场详解
iOS 视图控制器转场详解 前言的前言 唐巧前辈在微信公众号「iOSDevTips」以及其博客上推送了我的文章后,我的 Github 各项指标有了大幅度的增长,多谢唐巧前辈的推荐.有些人问我相关的问题 ...
- View Programming Guide for iOS ---- iOS 视图编程指南(四)---Views
Views Because view objects are the main way your application interacts with the user, they have many ...
- View Programming Guide for iOS ---- iOS 视图编程指南(一)
Next About Windows and Views 关于窗口和视图 In iOS, you use windows and views to present your application’s ...
- 浏览器视图层级中的“根”:<html>和<body>的属性研究
做前端开发的同学都会知道,每一个UI系统(比如IOS或Android)中都会有一个view hierarchy(视图层级)的概念,即所有的可视元素(大到一个页面,小到一个button)都在一个树形结构 ...
- iOS运用runtime全局修改UILabel的默认字体
iOS运用runtime全局修改UILabel的默认字体 一.需求背景介绍 在项目比较成熟的基础上,遇到了这样一个需求,应用中需要引入新的字体,需要更换所有Label的默认字体,但是同时,对于一些特殊 ...
- iOS 视图控制器 (内容根据iOS编程编写)
视图控制器是 UIViewController 类或其子类对象.每个视图控制器都负责管理一个视图层次结构,包括创建视图层级结构中的视图并处理相关用户事件,以及将整个视图层次结构添加到应用窗口. 创建 ...
随机推荐
- HTTP 笔记与总结(6)referer 头与防盗链
在百度贴吧(或 QQ 空间等)中找到一张图片,复制图片地址,在站外通过 img src 引用,会发现: 此外,在一些统计软件中,统计访客的来路(直接访问.外部链接.搜索引擎),都用到了 HTTP 协议 ...
- Sublime Text初识
一 基础安装1. 安装Package Control使用快捷键ctrl+`,调出输出窗口, 然后输入官网提供的代码, 获取代码地址:https://packagecontrol.io/installa ...
- UIButton 长按点击 背景改变效果
1.添加按钮的点击事件和按下事件 [btn setImage:[UIImage imageNamed:@"NorMal.png"] forState:UIControlStateN ...
- Bootstrap页面布局18 - BS导航路径以及分页器
导航路径:又叫“面包屑”,功能是让用户知道所处的位置. <!--面包屑--> <ul class='breadcrumb'> <li><a href='#'& ...
- jquery鼠标移入某区域屏蔽鼠标滚轮 滚动滚动条
<script> var firefox = navigator.userAgent.indexOf('Firefox') != -1; function MouseWheel(e) { ...
- EFDC主控文件efdc.inp文件的xml格式化处理——转载http://blog.sina.com.cn/s/articlelist_1584892573_0_1.html
在对EFDC模型进行系统集成时,虽然可以通过一行一行读来进行解析处理,但那将是一个繁琐的工作.我们经过xml格式化处理后,再经xsd转成Dataset类对象,那么整个主控文件就是一个数据库表集合,对其 ...
- web项目中 集合Spring&使用junit4测试Spring
web项目中 集合Spring 问题: 如果将 ApplicationContext applicationContext = new ClassPathXmlApplicationContext(& ...
- C++ char*,const char*,string的相互转换
1. string转const char* string s ="abc";constchar* c_s = s.c_str(); 2. const char*转string ...
- Web工程与RMI工程进行联调
1.首先导出RMI工程中的Service和entity类 到web工程中,以jar包的形式 public class ServiceManagerImpl { private static Servi ...
- Jquery手册
1.jQuery 选择器: 选择器 实例 选取 * $("*") 所有元素 #id $("#lastname") id="lastname" ...