0

I have a UILabel object instance declared in the interface builder and I set its position with instance method setFrame:CGRectMake.

Is it possible to duplicate this label and have it be at two spots on the same view controller?

So have something like this?:

[label setFrame:CGRectMake(20,49,135,35)];
[label setFrame:CGRectMake(110,49,135,35)];

Because I want to reuse this same label.

matts
  • 6,738
  • 1
  • 33
  • 50

2 Answers2

0

In short. No. You have to make a separate UILabel object instance.

Tip: create a UILabel subclass if you want to provide a custom functionality for your labels and encapsulate that features in a custom class to keep your code clean and well organised.

damirstuhec
  • 6,069
  • 1
  • 22
  • 39
-1

You can create a copy of it, check out this answer for how to do that:

How do copy for UILabel?

Community
  • 1
  • 1
Jack
  • 16,677
  • 8
  • 47
  • 51