·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> app软件开发 >> IOS开发 >> 遍历子视图中某个类型控件方法

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

作者:佚名      IOS开发编辑:admin      更新时间:2022-07-23
    NSMutableArray *textFieldArray = [NSMutableArray arrayWithCapacity:5];
    
    for (UIView *textField in self.view.subviews) {
        if ([textField isKindOfClass:[UITextField class]]) {
            [textFieldArray addObject:textField];
        }
    }

用isKindOfClass判断指定类型