I am exploring the development of my first iPhone app (Xcode and Swift 3) and I need some direction and advice. I have a need of a multiple level expanding and collapsing table. I've attached some screens of a web app I developed to help you understand where I am going. In my app there are main level items, which expand to show sub items, which expand to show the contents of that item. And not every sub item (when expanded) has the same elements. Some sub items have simple text fields while other items have questions with yes and no answer options. I am so green I don't even know where to start with pulling this off in an app. I have worked through some tutorials on expanding and collapsing dynamic cells but I am unaware if that is the best way because not all of my sub cells contain the same contents. Should I use static cells instead? Or is there a way to create cell templates (like include files in php) and call them in to the table and populate them when I need them? I am lost and need some direction. Any help you can give me would be greatly appreciated. I would love tutorials as well. I have a Lynda.com account if you are aware of tutorials there I should follow. Thank you!
one of the simple layouts
a different layout
I think this lib could help you.
Attempting to write a delete function. I am building an app to list courses after a button is clicked. I am using a text view to display this information and appending each course with a new line. Now i want the user to be able to delete a course. I was thinking if i can keep track of which line the user is on right now, then i can also tell which line the user will like to delete. Thoughts? Maybe there is a better way of doing this, perhaps using labels instead of text view?
EDIT: Use table view /s
You should use a UITableView to create a section for "Courses" and create rows in it with your courses.
And you should handle the insert/delete with the UITableView methods.
Check this out, or similiar tutorials out there.
Perhaps you could use a UITableView to achieve this. One benefit to using a UITableView is you can use built in functionality for deleting and creating new items. Here is a guide on UITableView.
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
Well if i understand your question correctly, what you search is called nested tableView, here's some examples:
SDNestedTable
ExtensiveCell
CollapseClick
JKExpandTableView
Good luck.
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.
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.
Is it possible to both edit and delete a table row after you enter editing mode on the TableView? I have figured out how to do the delete one seperately. Using the standard editing button and then delete.
But I would like it to be so that I can press the edit button, and it gives me the option per row to delete or edit. Like the way it works in the Clock > Alarm on your iphone. Both options are activated through the edit button, but I don't quite see how.
I have looked on google, and stackoverflow but I cannot find a solution to this. If there are any examples out there or tutorials that you know of (and I did not find) please do share them.
You could try to change your didSelectRowAtIndexPath method. Do a check if the [self.table isEditing] and if it is editing you change what your didSelectRowAtIndexPath method does.
I am creating table using UIView on I-Pad but the problem is it creates for one column with multiple rows and I want table composed of multiple rows with multiple columns. Could anyone please suggest me some ideas anything that will work to solve this problem.
There are a few open source grid view controls around. Try:
AQGridView
DTGridView