Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有大约 20 个文本字段的视图,我想检查有文本的字段数,而不是空的数字。最好的方法是什么?
假设文本字段在里面theView:
theView
NSUInteger count = 0; for (UITextField *textField in theView.subviews) { if ([textField isKindOfClass: [UITextField class]]) { if ([textField.text length]) count++; } }