查看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 类或其子类对象.每个视图控制器都负责管理一个视图层次结构,包括创建视图层级结构中的视图并处理相关用户事件,以及将整个视图层次结构添加到应用窗口. 创建 ...
随机推荐
- Front-end Developer Interview Questions
Front-end-Developer-Interview-Questions A list of helpful front-end related questions you can use to ...
- mysqli常用命令
<?php //创建连接 $mysqli=new mysqli("localhost","root","","volunte ...
- 冒泡排序与插入排序(C#实现)
本人应届生面试,发现被问了2次关于排序的算法.当时竟然没写出来!!!好吧,可能是用库函数多了,很久没搞算法了,在纸上写没感觉吧. 今天花了1个多小时写了下冒泡排序与插入排序(C#实现),并写了注释和小 ...
- 在XE5中 VCL空窗体的3个线程
中午看到技术群里有人讨论, XE5一个空窗体程序就包含了3个线程, 赶忙打开XE5开了个空窗体一看, 果然如此 再打开D7和2010看了一下, 都是一个线程 这时看到有人说一个是输入法, 一个是GDI ...
- python 之 推导式
推导式 : 英文 comprehension 支持推导式的有列表list 字典dict 集合set 注意元组没有 推导式,如果你那样去写,他会变成一个generator生 ...
- python之列表切片(slice)
使用索引获取列表的元素(随机读取) 列表元素支持用索引访问,正向索引从0开始 colors=["red","blue","green"] c ...
- HBase的几种调优(GC策略,flush,compact,split)
一:GC的调优 1.jvm的内存 新生代:存活时间较短,一般存储刚生成的一些对象 老年代:存活时间较长,主要存储在应用程序中生命周期较长的对象 永久代:一般存储meta和class的信息 2.GC策略 ...
- javax.management.NotCompliantMBeanException
public interface QueueMBean { } 假如接口名叫 XMBean ,那么实现名就必须一定是X,而且是大小写敏感的. public class Queue implements ...
- webKit和chromium的文章地址
http://blog.csdn.net/column/details/yongsheng.html?&page=1
- 查询数据表,去除符合某些条件的记录,没有自动增长列(not exists)
select distinct ccode,isnull(cexch_name,''),N'',N'',N'2014.03',0,1,1,1,12 from RP_bankrecp where not ...