2012-11-27 87 views
0

我在故事板中动态创建了lables标签。 现在我想命名这些标签。 我不知道该怎么办。 这是我的代码:动态命名标签-ios

<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> 

在这里,我使用的HTML代码中storyboard.i我取出由数据库值,并把这些值作为拉布勒text.I只需要命名和值将被传递在屏幕上 这是主要的文件夹文件

回答

1

您可以为每个标签设置标签属性,如10,11,12所示。

然后

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