Curious_k.shree
Curious_k.shree

Reputation: 1020

name the label dynamically -ios

I have created lables dynamically in my storyboard. now i want to name those lables. i am having no idea what should i do. this is my code:

<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Data Updated on  July 7, 2012" textAlignment="right" lineBreakMode="tailTruncation" minimumFontSize="10" id="ovU-eL-SMN">
                               <rect key="frame" x="313" y="961" width="444" height="30"/>
                               <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                               <fontDescription key="fontDescription" type="system" pointSize="16"/>
                               <color key="textColor" red="0.047058823530000002" green="0.0" blue="0.35294117650000001" alpha="1" colorSpace="calibratedRGB"/>
                               <color key="highlightedColor" cocoaTouchSystemColor="darkTextColor"/>
                           </label>

here, i am using html code in storyboard.i am fetching value from database and put those values as lable text.I just have to name it and the value has to be passed in appdelegate this is the mainstoryboard file

Upvotes: 0

Views: 167

Answers (1)

Pandey_Laxman
Pandey_Laxman

Reputation: 3908

You can set tag property of each label like 10 , 11 , 12 as many you have label.

Then

for(int i=10 ;i<last_label_Tag;i++)
{
UILabel *lbl=(UILabel*)[self.view viewWithTag:i];
lbl.text=@"Define text for the labels"// or you can use separate Labels without loop.
}

Upvotes: 2

Related Questions