Comment obtenir un certain sous-vue de UIView par tag

Je suis un noob en Objective-C et j'ai une question.

J'ai un UILabel objet que je l'ajout d'une UIView avec ce code:

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,10,self.view.frame.size.width-15-70, 30)];
label.tag = 1;
label.font = [PublicObject fontTexts:17];
label.textAlignment = NSTextAlignmentRight;
label.textColor = [UIColor whiteColor];
[cell setBackgroundColor:[UIColor clearColor]];

 UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
 view.backgroundColor = [PublicObject colorWithHexString:@"cd4110"];
 label.text = [filterData objectAtIndex:indexPath.row];
 view addSubview:label];

Maintenant, je veux obtenir une sous-vue, à mon avis, où cette sous-vue a tag = 1 et l'enregistrer sur un autre objet, comme ceci:

UILabel *tagLabel;
tagLabel = //I want get one subview in view where tag = 1 

S'il vous plaît aidez-moi à comprendre comment faire.

  • Tout d'abord, il peut y avoir plusieurs sous-vues avec un tag. Alors bonne question à poser est "comment obtenir des sous-vues de uiview par tag".
InformationsquelleAutor user3797431 | 2014-07-02