如何创建和使用可重用的视图模板

时间:2012-03-12 11:30:01

标签: ios xcode ipad uiview subviews

我是iOS开发的新手并站在某种问题面前:

我需要像view-template这样的东西,我可以在另一个视图中加载和填充多次。

例如: 视图模板存在:

的UILabel UIImageView UILabel UIButton

在我的应用程序中,我想动态加载它多次:

[myAppView]

UILabel
Something...
Something...

view-template (with added content)
view-template (with added content)
view-template (with added content)
view-template (with added content)
view-template (with added content)

Something...

[/myAppView]

我该怎么做? 这是有用的开始:link

1 个答案:

答案 0 :(得分:0)

根据评论,听起来您的目标就是创建一个自定义的UITableViewCell,并填充模型数据。

执行此操作有很多意见和选项,具体取决于设计的复杂程度,UITableView中的行数以及其他考虑因素。

查看有关自定义UITableViewCell的一些教程。与thisthis

相同