如何使用NSPredicate按标签过滤NSArray子视图?

我有这个子视图数组:

<UIButton: 0xa2b1600; frame = (41 20; 42 30); opaque = NO; autoresize = RM+BM; layer = >, <UIButton: 0xa2b1290; frame = (121 694; 69 30); opaque = NO; autoresize = RM+BM; layer = >, <SequenceViews: 0xb16fba0; frame = (62 393; 280 323); tag = 100; gestureRecognizers = ; animations = { position=; }; layer = >, <SequenceViews: 0xb171c30; frame = (62 52; 280 323); tag = 101; gestureRecognizers = ; animations = { position=; }; layer = >, <SequenceViews: 0xb17d430; frame = (372 222; 280 323); tag = 102; gestureRecognizers = ; animations = { position=; }; layer = >, <SequenceViews: 0xb178ba0; frame = (682 393; 280 323); tag = 104; gestureRecognizers = ; animations = { position=; }; layer = >, <SequenceViews: 0xb16a9f0; frame = (682 52; 280 323); tag = 105; gestureRecognizers = ; animations = { position=; }; layer = > 

我无法弄清楚如何通过tag过滤视图。你们中的任何人都知道我如何按标签过滤子视图数组?

我弄明白:

 NSPredicate *tagPredicate = [NSPredicate predicateWithFormat:@"self.tag >= 100"]; NSArray *resultArray = [[self.view subviews] filteredArrayUsingPredicate:tagPredicate]; 
 UIView *mainView = self.view; NSArray *subViews = [mainView subViews]; NSPredicate *predicate = [NSPredicate predicateWithFormat: @"self.tag in %@", @[@101, @102, @103]]; NSArray *filteredViews = [subViews filteredArrayUsingPredicate: predicate]; 

您是否反对使用标签跟踪您的观点?

设置标签: self.nameLabel.tag = 13

检索带有标记的视图: UILabel *myLabel = (UILabel *)[UIView viewWithTag:13];