美文网首页
遍历子视图中某个类型控件方法

遍历子视图中某个类型控件方法

作者: 彗星来的那一夜 | 来源:发表于2016-11-09 20:52 被阅读15次
NSMutableArray *textFieldArray = [NSMutableArray arrayWithCapacity:5];
    
    for (UIView *textField in self.view.subviews) {
        if ([textField isKindOfClass:[UITextField class]]) {
            [textFieldArray addObject:textField];
        }
    }

用isKindOfClass判断指定类型

相关文章

网友评论

      本文标题:遍历子视图中某个类型控件方法

      本文链接:https://www.haomeiwen.com/subject/tzstpttx.html