使用递归:

- (void)listSubviewsOfView:(UIView *)view {

    // Get the subviews of the view
NSArray *subviews = [view subviews]; // Return if there are no subviews
if ([subviews count] == 0) return; // COUNT CHECK LINE for (UIView *subview in subviews) { // Do what you want to do with the subview
NSLog(@"%@", subview); // List the subviews of subview
[self listSubviewsOfView:subview];
}
}

方法转载自:http://stackoverflow.com/a/7244069/3458781

打印结果:

2014-10-10 16:05:14.191 MyAPP[1951:60b] <UIView: 0x16d61a90; frame = (0 64; 320 31); autoresize = RM+BM; layer = <CALayer: 0x16ddb850>>
2014-10-10 16:05:14.192 Vinyo[1951:60b] <UILabel: 0x16d1aa60; frame = (15 70; 210 20); text = 'Choose a credit card'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x16d1c7f0>>

iOS 打印出视图中全部的子视图的名称的更多相关文章

  1. Tree Operations 打印出有向图中的环

    题目: You are given a binary tree with unique integer values on each node. However, the child pointers ...

  2. CATransition:视图替换动画:子视图的增删查改

    CATransition通常用于通过CALayer控制UIView内子控件的过渡动画,比如删除子控件,添加子控件,切换两个子控件等. 用于子视图的增删查改:

  3. 得到UIView中某个非子视图在UIView中的位置

    使用 convertRect: fromView: 或者 convertRect: toView:例如一个视图控制器的view中有一个UITableView,UITableView的某个cell中有个 ...

  4. YII总结学习7(在一个视图中显示另外一个视图)

    controller\hello <?php namespace app\controllers; use yii\web\Controller; class helloController e ...

  5. asp.net mvc 在视图中获取控制器与动作的名称

    获取 controller 名称: ViewContext.RouteData.Values["controller"].ToString(); 获取 action 名称: Vie ...

  6. 关于cell中添加子视图 复用重叠问题的解决方法

    问题本质:   因为你要添加的子视图并不是在自定义的cell中实现的,而是根据系统给的UITableViewCell这个类创建的实例,每次进图 cellForRow方法都会创建一个cell,每次都要创 ...

  7. IOS自己主动布局中的浮动布局(6)----MyFloatLayout横空出世

    https://github.com/youngsoft/MyLinearLayout 前言 在MyLayout的6大布局中,每种布局都有不同的应用场景. 且每种布局的子视图的约束机制不一样:线性布局 ...

  8. 【转】 UIView如何管理它的子视图

    原文:http://my.oschina.net/u/1984662/blog/293690 目录[-] Core Animation基础 改变视图的层 动画支持 视图坐标系统 边框.边界.和中心的关 ...

  9. MVC打印表格,把表格内容放到部分视图打印

    假设在一个页面上有众多内容,而我们只想把该页面上的表格内容打印出来,window.print()方法会把整个页面的内容打印出来,如何做到只打印表格内容呢? 既然window.print()只会打印整页 ...

随机推荐

  1. 自定义控件三部曲之动画篇(四)——ValueAnimator基本使用

    前言:不要让别人的无知断送了你的梦想,永远坚信你所坚信的. 相关文章: <Android自定义控件三部曲文章索引>:http://blog.csdn.net/harvic880925/ar ...

  2. Android系统之Recovery移植教程 【转】

    本文转载自:http://luckytcl.blog.163.com/blog/static/14258648320130165626644/ recovery的移植,这方面的资料真实少之又少啊,谷歌 ...

  3. php执行运算符

    php执行运算符 简介 php 支持一个执行运算符:反引号(``).反引号(``)位于键盘Tab键左上方.php 将尝试将反引号中的内容作为外壳命令来执行,并将其输出信息返回(例如,可以赋给一个变量而 ...

  4. 2015 多校赛 第一场 1002 (hdu 5289)

    Description Tom owns a company and he is the boss. There are n staffs which are numbered from 1 to n ...

  5. Socket server

    Socket server的使用方法(精华部分),仅供自用. class MyServer(socketserver.BaseRequestHandler): def handle(self): wh ...

  6. listview 控件

    private void Form1_Load(object sender, EventArgs e) { //设置该listview关联的imagelist listView1.LargeImage ...

  7. js手机网络检测

    <!DOCTYPE HTML> <html lang="en"> <head> <meta charset=UTF-8"> ...

  8. go开发和运行环境的配置

    1.运行环境的下载.安装.配置: 下载:http://www.golangtc.com/download  官网下载经常被墙屏蔽,所以就从golang中国下载; 安装及其配置:http://jingy ...

  9. 获取 Windows Phone 的 User-Agent 字符串

    这个是简单介绍一下如何在wp开发中获取 Windows Phone 的 User-Agent 字符串,更多wp移动开发就去那个wp教程网吧.http://wp.662p.com 使用方法 public ...

  10. WinRAR 5.60 无广告正式版

    首先明确WinRAR唯一的官网是这个 https://www.rarlab.com/ 其余的都不要相信. 现在的问题是:不要脸的中国代理强行捆绑广告:即使你花钱注册同样要面对弹窗广告!这就不可接受了! ...