I'm trying to add a list within each tableview cell that will go to the right of an image. Each list may create new items and remove them. Each item is it's own textView that will show all of the lines. I want the cell to be able to resize itself based on the height of the list.
I've tried using sections but I want the header to be to the left of the list, not above.
I've looked at trying to make each UITableViewCell it's own tableView and put the list in there. However, I think it will be difficult to determine the size of it since some list items will be more than one line.
I've thought about adding stack views to help with the dynamic resizing of the cell.
Is there a good way to do this? Is there a different approach?
Related
I am making an app that use table View Controller and static cell.
I want to make first cell don't scrolling while other can. This is a picture of what i am talking about.(Sorry for my bad English)
For example as in this picture, I want to make 9gag tab stay when scroll. If you play instragram you will see that when you scrolling the name of user will stay until you scroll into another one. However I want it to stay not changing when it encounter second cell.
Any suggestion?
Using UITableViewController would not help here. You can use these steps to get what you want:
1. Create a UIViewController.
2. Add UITableView as its subview.
3. Add another UIView as UIViewController's view's subview.
4. Using auto layout constraints, you can put UIView above UITableView
This way, you will get a sticky view at the top.
Ok, not exactly sure what you're after but i'll take a stab.
Firstly, if you want the section to remain in place until a new section of items is present, you just need have a look at sections. This is an automatic feature. You may not see it occur until you have plenty of items in the sections.
UITableView With Multiple Sections
There's plenty of stuff about it & not too hard to implement.
My other guess of what you want:
If you want it to remain static regardless of anything, perhaps you could just create a view and place it above the table view. why does it need to be a part of it if it doesn't change?
I'm trying to figure out what kind of iOS user interface element(s) I should be using to create this interface:
At the bottom of this view, there is a list of items. This list of items can be arbitrarily long. As such, and because of the standard detail disclosure indicator and so on, it makes sense that this is a tableview.
However, the items at the top are not tableview cells. The obvious answer then, is to simply place a tableview on the view, i.e. an embedded tableview. But this leads to another obvious issue, which is that this entire view should be scrollable - there will be a button for "Add Item" underneath the list of items which you will need to be able to scroll to, and the interface will be crappy if the whole view doesn't scroll.
So, I could make it so the tableview is not scrollable, and is just as tall as it needs to be to include as many items as it needs to. Then, the entire view is embedded in a scrollview, and scrolls properly. My concern with this relates to memory management, if I do this, I don't think I'll be taking advantage of the dynamic cell creation that is inherently part of a scrollable tableview, and will instead have dozens or even hundreds of cells instantiated when the view loads.
Another alternative would be to make the entire interface a tableview, with the top portions, and the bottom button, implemented as custom tableview cells that are different from the cells that show items. In the past, however, I've found that this is a pain-in-the-ass too, but perhaps it's a pain I must endure.
In general, I feel like I'm missing an obvious approach here, since this seems like it ought to be extremely simple to implement, but I'm currently at a loss. Help is appreciated!
jjv360 mentioned it correctly, this should be 1 tableview with sections and custom cells. The different look comes from nice images.
It's all a tableview with a single cell type, and 4 sections.
The cell has an optional image, a label and the optional disclosure indicator. If those don't exist, the label expands to encompass the full space.
It's very easy to do, quite standard.
I need an advice for a thing I want to implement for an iPhone application.
Actually what I want is to have the ability to dynamically populate a TableView with a specific template delivered by an engine (is it clear ? ...)
For that I want each of my TableViewCell of the TableView to be a UICollectionView.
For example :
I want to display an image, a title and a subtitle in my cell (I know I can do this by using a UITableViewCellStyleSubtitle, but when I have more complicated things to display it won't work with it).
For that, I want a UICollectionView with 2 columns and 2 rows on each column. The first item (image) will be placed on 0,0 with a 2 colSpan (to take the whole column). The second item (title) on 1,0 and the third item (subtitle) on 1,1.
I also want the collection view items to be sized correctly.
So 2 questions :
1) Is it a good way to work with a UICollectionView, or is there simpler ways ?
2) How can I specify rows and columns, along with colspan and rowspan in a UICollectionView ?
Thank you very much for your answers :)
A collection view is overkill for this. Just define a cell with custom subviews. You can resize them if required when the cell is populated. You haven't said what the most complex or simplest layout will be so I can't offer any more specific advice.
I am trying to configure my CollectionView to have one section be differently sized than the others. I have two sections. Lower part should show a number of cells simultaneously and the upper section should only show one cell at a time but be scrollable to reveal more cells one by one.
I tried to play with the .frame property of the CollectionView but obviously it is not the right approach as it changes the appearance of the whole view.
I also tried to retrieve the FlowLayout object and see if I can get it from there. Did not find a way.
Neither the section Insets are the answer so far ...
It is simple to use two uicollectionviews for upper and lower section, instead of using only one.
I am trying to create a UITableView that has cells with PageControls in them, which would allow each cell to scroll sideways to different views... I am using the Apple UIPageControl project here and basically trying to insert one of these PageControl objects into a UITableViewCell.
I am pretty new to iOS and I'm having a hard time wrapping my head around how to customize the cell the way I want to... the cells are still showing up as the default ones with a title label.
Could someone please help me or at least tell me if what I'm trying to do is possible? :)