如何创建一个类似于Contacts应用程序的可编辑UITableView? (苹果手机) [英] How to create an editable UITableView like that of the Contacts app? (iPhone)
问题描述
我正在寻找一种方法来开发如下所示的视图。最简单的方法是什么?我应该创建一大堆不同的自定义UITableViewCell,还是可以使用某种框架?
I'm looking for a way to develop a view like shown below. What is the easiest way to do this? Should I just create a whole bunch of different custom UITableViewCell's or is there some sort of framework I can use?
更具体地说,我想知道如何创建单个可编辑单元格例如'mobile(408)555-5555';我如何创建它并允许用户编辑它?如果我还想创建一个允许用户选择几个可检查选项的单元格,我该怎么做?另一种情况可能是在单元格中使用切换开关。
More specifically I'm wondering how to create the individual editable cells e.g. the cell with 'mobile (408) 555-5555'; how would I create this and allow users to edit it? If I also wanted to create a cell that allows users to select several checkable options how could I do this? Another case could be the use of a toggle switch in the cell.
注意:我不打算开发设置视图,用于其他目的。
NOTE: I'm not intending to develop a settings view, its for other purposes.
推荐答案
你可以在故事板中使用我最喜欢的东西,静态表格视图。
You can use my new favourite thing, static tableviews in storyboard.
在情节提要编辑器中,创建一个新的表视图控制器并将内容类型设置为静态。设置部分数量,在单元格中拖动并配置,设置一些出口 - 完成!
In the storyboard editor, create a new table view controller and set the content type to static. Set the number of sections, drag in your cells and configure, set up some outlets - done!
您需要从视图控制器中删除所有数据源方法才能使其正常工作。是的,你没有看错。
You need to remove all of the datasource methods from the view controller for this to work. Yes, you read that right.
这篇关于如何创建一个类似于Contacts应用程序的可编辑UITableView? (苹果手机)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!