简体   繁体   English

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

[英]How to create and use reusable view-templates

I'm new to iOS development and standing in front of some kind of Problem: 我是iOS开发的新手,站在某种问题的前面:

I need something like a view-template which i could load and fill multiple times inside another view. 我需要一个类似视图模板的东西,我可以在另一个视图中多次加载和填充。

For Example: The view-template exists of: 例如:视图模板存在于:

UILabel UIImageView UILabel UIButton UILabel UIImageView UILabel UIButton

In my App i want to load it dynamicaly and multiple times: 在我的应用程序中,我想动态地多次加载它:

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

How can i do that? 我怎样才能做到这一点? Is that and usefull start: link ? 那是有用的start: link吗?

From the comments, it sounds like your goal, then, is to create a custom UITableViewCell which you populate with model data. 从注释中听起来,您的目标就是创建一个自定义UITableViewCell ,并在其中填充模型数据。

There are many opinions and options for doing this, depending on the complexity of your design, number of rows in the UITableView and other consideration. 根据设计的复杂性, UITableView的行数以及其他考虑因素,有很多意见和选择可以做到这一点。

Check out some tutorials on custom UITableViewCell . 查看有关自定义UITableViewCell一些教程。 Like this , or this 喜欢这个这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM