iphone - How to construct IBOutlet names in code in order to change them? -


Let me assume that I have many UILBels installed in IB and that the codes are connected to IBOulets (label 1, label 2, label 3, label 4)

How do I get these variables inside the code , So that I can change the text of each one in the loop, where the labels are taken from NSARRA.

  labelArray = [NSArray arrayWithObjects: @ "this", @ "array", @ "is", @ "a", @ "Random", @ "zodiac", @ "of", @ "item", zero]; For (int i = 0; i & lt; [labelArray count]; i ++) {// labelx ibotlet lablex.text = [Label Array object is the creation of the index: }  

How do I create 'labelx' above? Can it be done using blocks?

You must initialize the array to a place,

  labelArray = [NSArray arrayWithObjects: @ "this", @ "array", @ "is", zero]; UiLabelArray = [NSArray arrayWithObjects: label 1, label 2, label 3, zero]; ()  

then

  (int i = 0; i  [uiLabelArray count]; i ++) {[ UiLabelArray ObjectOutIndex: i] .text = [labelIreObjectIntindexX: i]; }  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -