Swift: How to make categories with UITableView? - ios

I found this example which is what exactly I want. I am trying to make a table which the cells/sections collapse and expand. All the data in the parent cell and child cell are not fixed data which means I want to get them from web service (Parse). I was wondering how can I create one and what is the easiest solution to get me working with this.

Related

Is there a way to delete user specified lines from text view?

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.

With IOS, is there a way of making a proper table with rows and columns?

I have been trying to find a way of creating a table, with rows and columns, for iOS. The UiTableView is basically a tree-structured list like this
Apple sample code, but because it's called a table view, it hijacks any attempt to search for a proper table.
There are a couple answers that suggest very clunky ways of doing it, like this SE Question, but it's quite old. Has the situation changed since this question was asked?
I've done this using UITableView by simply designing custom UITableViewCells that are segmented into columns. All the custom rows together certainly give the appearance of a multi-column table. When any of your data in a column or row updates, you re-render the tableView or have each row in charge of its own re-rendering (i.e. via an NSNotificationCenter message), and the whole experience for the user is as a multi-column table. If you setup your table's data as a separate row-column data model, it's pretty easy to get all the individual cells to go where they need to go with your custom UITableViewCell.
take a UITableView and on tableRow take 3 view of(width=1 and height=row height), each view ill be at equal distance from another one. and take label between these view at end it ill look like a table with rows and column

UICollectionView With Multiple Cells - Is It Possible?

In the process of discovering the UICollectionView as a replacement for the UITableView.
I have created a very basic collection that contains a single section and single Cell, but displaying multiple values that is amended into a NSString. I believe it's a clunky way of doing things.
Take a look at the following image to get an understanding what I have done and how I have done it:
What I would like to know, is it possible to create a Collection View that uses multiple Cells that I can use to contain the values. Check out the following graphic to give you an idea on what I would like to achieve:
Possible??

UITableView with multiple types of cells

What is the best approch to make feed view like shown in picture ?
One approach I know is One section per post and multiple rows for internal content.
But when there is repeating content like Comments here what to do ? I am looking for better approach.
Help!!
You can add a UITableView as a subview of a UITableViewCell! It can get a bit hairy when creating a data source for such a thing, so it's best not to use the same ViewController as the delegate for your main table and each cells table.

Insert cells into a section of an already statically created table

I am creating an iOS app that has a form to create a certain 'event'. This form is wrapped in a tableview. This tableview consists of static cells. But there is one section in the table that can be used to add persons to this event and thus on a button press a new tableview cell needs to be inserted at that section. To demonstrate this see the following image:
What I want to know is how to insert cells into a static table. And also how to grab them when the user submits the form, since, as far as I'm concerned, you can't grab a specific section of a table.
I already looked at this kind of concept but this does not apply on adding cells:
Mixing static and dynamic sections in a grouped table view
Thanks,
I think there are (at least) 2 workarounds for this:
You could add a dynamic UITableView as a child to the UITableViewCell. See this stack overflow question about this.
An other solution would be to bypass the table functionality in that cell and change the height of the cell and add the extra controls manually.
It's not possible to add or remove cells at runtime, you'll need to use a data source for your tableview. I asked a similar question here, with no luck.
In response to your second question, you can always grab cells using the cellForRowAtIndexPath: method on UITableView.

Resources