I have added a number of labels to a view giving them tags.
What is the correct way to retrieve a label from the view. I am wanting to re-postion the label. Here is what I am using to retrieve the label and re-position it:
UILabel *theLabel = (UILabel *)[self.view viewWithTag:5];
[theLabel.layer setPosition:CGPointMake(100, 200)];
To retrieve the label, use an
IBOutlet if you've created it in Interface Builder, or a raw property or ivar if created in code. There's no need to loop the subviews or use
viewWithTag if you've got a direct reference (outlet, property, ivar) to it.
To move the label, directly set its
center property without needing to access its layer.