Iterate/Loop through all properties of a class in Objective C

前端 未结 1 385
情书的邮戳
情书的邮戳 2021-01-15 02:17

Possible duplicate: Looping through properties in a class

The problem is I have number of UILabels on each row upon a UITableView and I need to map the properties of

相关标签:
1条回答
  • 2021-01-15 03:00

    If you're talking about UILabels, I will assume you want to use them via IB in Xcode, however you're creating them in code just because you can loop in code.

    If so, you can think about using IBOutletCollection instead of IBOutlet like below:

    @property (nonatomic, strong) IBOutletCollection(UILabel) NSArray *titleLabels;

    the order in this array will be the same, as you add them in the IB ui.

    Hope, this helps.

    0 讨论(0)
提交回复
热议问题