質問

I have a table view with expanding cells for each of them. I want to make every expanding cell be a new table inside of the bigger one. Is that possible? I've done the research, someone said that duplicate UITableView cannot put in one file.

For example

dish order1

=================

dish order2


rice


coke

===============

dish order3

which every "dish order #" is a cell of a table, and when you expand one cell, there will be a smaller table appears. I've done all the expanding stuff. But don't know how to put a small table into a bigger one. Thanks

役に立ちましたか?

解決 2

It would likely be impossible to put one table view inside of another table view, and if you did manage to do it, it would be awful. Ask yourself, have you EVER seen this in a commercial app? If not, as a novice iOS developer, you are out of your depth trying to invent new UI paradigms.

Master the existing UI tools first. Don't try to use the UI elements in totally novel ways until you have a strong feel for the standard way to use them. Expect this to take 6 months or more.

Others have suggested a sectioned table view where initially only the first element of a section is visible, but when you tap on it, it expands to add other rows. This works quite well.

Another approach would be to use a master/detail UI, where tapping on one table view cell pushes a new view controller the uses a new table view to display detail information about the previously selected item. There are some use cases where you might have several levels of increasing detail.

他のヒント

Well if i understand your question correctly, what you search is called nested tableView, here's some examples:

Good luck.

I really do not think you want two instance of UITableView, instead what you want is a sectioned UITableView which expands when it's header is tapped. Apple has a good sample code for this here:

UITableView expand/collapse

i have demo for you , just got from github..

https://github.com/mitsBhadeshiya/ExpandingCell

i hope this is helpfull for you...

Have you considered using one UITableView with multiple sections? You can accomplish what you are depicting above with only one tableView.

Since this was a problem for many people in the past, iOS 9 has a thing called Stack View, it does exactly what you are saying.

Check out this article.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top