首页 > 代码库 > 遍历子视图中某个类型控件方法

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

    NSMutableArray *textFieldArray = [NSMutableArray arrayWithCapacity:5];
    
    for (UIView *textField in self.view.subviews) {
        if ([textField isKindOfClass:[UITextField class]]) {
            [textFieldArray addObject:textField];
        }
    }

用isKindOfClass判断指定类型