iOS 动态创建 UILabels
有时我希望我的视图包含 5 个 UILabel
,有时是 3 个,有时是 n。
UILabels 的数量取决于从网站获取的数据。
Sometimes I want my view to contain 5 UILabel
s, sometimes 3 and sometimes n.
The number of UILabels depends on data that's fetched from a website.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您必须用代码而不是界面生成器来制作它们
You'll have to make them in code instead of interface builder
通用问题的通用答案:
A generic answer for a generic question:
- 这里UILable将被动态创建。
- 但属性的设置会有所不同。
-Here UILable will be created dynamically.
-but property will be set differently.
创建一个
TextView
以显示标签上的文本,并创建一个NSArray
以包含数据。欲了解更多信息:
Create a
TextView
to show the text on the labels and aNSArray
to contain the data.For more information: