我有几个UIView的IBOutlets;我父视图中的几个子视图。 我试图遍历所有UIView的子视图。 我想循环遍历所有以“view _”
开头的IBOutlet名称的子视图有人可以帮我这个吗? 问题是我真的想要访问IBOutlet的名称。
这是我的澄清代码:
@property (weak, nonatomic) IBOutlet UIView *view_player1;
@property (weak, nonatomic) IBOutlet UIView *view_player2;
@property (weak, nonatomic) IBOutlet UIView *view_referee1;
- (void)listSubviewsOfView:(UIView *)view {
// Get the subviews of the view
NSArray *subviews = [view subviews];
// Return if there are no subviews
if ([subviews count] == 0) return;
for (UIView *subview in subviews) {
NSLog(@"my subview name is: %@", subview.class); //?? is only giving my the type eg UIView, i want it to return view_player2
// List the subviews of subview
[self listSubviewsOfView:subview];
}
}
我如何才能真正获得子视图的IBOutlet的名称,如果它只以单词“view _”开头,则进行比较
由于