Inside my UITableView I have 2 types of cells lets say A and B.
Initially, my table shows only cells of type A and when the user taps on any cell, I display a list of type B cells to give sort of a drop-down effect. Now the issue is when I tap on a cell of type A it's drop-down may have a large number of type B cells, so what I want to do is limit the number of cells in the dropdown to 3 and then scroll the rest of them in the same position and then have the list of type A cells after that. I have no idea how to do this, any help is greatly appreciated.
Try to set bellow constraint in your internal tableview that is collapse and expand.
Related
I am using an UICollectionView to display a list of items in a 2 column layout with equal size of columns. This is obtained by a flow-layout.
Simple.
However, the first row is different from the rest, as it can vary from being full "screen" width or two column width. In continuation hereof, the collection view displays two types of cells (A and B). A is always displayed with full "screen" width in first row and B cells always in columns of two.
An option button can switch displaying type A cell or not.
All this can be brought to work with a flow-layout and proper width sizing of the items through delegates.
Unfortunately, when switching between not displaying type A cell with full width and displaying type A cell, an visual disturbance occur, because the collection view calls first delegate with "sizeForItem" and then collection view calls delegate "cellForItem":
collectionView(_:layout:sizeForItemAt:)
collectionView(_:cellForItemAt:)
This means that the "old" B cell in first row is being displayed with full width for about 1 second or less. Which does not look good.
Difficult to see any solution to this.
Hope someone can.
Below, three images shows how cell B is temporarily being shown with full width before cell A is being shown.
I have a collection view 3x3.
Item (collection cell) contains some icon and label.
I want some additional text to be shown inplace when user touches the cell. The view with this text must be fullscreen width.
In other words I want to insert a view with text between collection rows. It's desirable that the view appears with animation.
How should I do that? The first ideas I've got are:
Divide CollectionView rows into sections and use section footer for this purpose. Make this footer of zero size and show it when needed.
Dynamically create full-width cell and insert it at the end of the row where selected item is located.
Both methods seems tricky to me. Maybe there is more straight forward way?
Any ideas? Thanks!
I know the title is confusing. So I explain what I expect.
I have 3 sections in my table view. The first section has one or more rows. And second and third sections has only one row. When the first section has more than 4 rows the next sections going to be visible by scrolling table view bottom.
But I need these sections be visible in this case.
Actually I need show these sections at the bottom of the visible frame when first section has more than 4 rows!
Is it possible ?
The thing you can do it to display only the 3 first rows of the first section and then when the user starts scrolling, you add the additional cells to the first section while he is scrolling until you've added all of your cell.
Do the opposite when scrolling to top.
You can use two different TableView instead of one.
declare first TableView with only one section & seconds TableView with two section with one row each.
for that you need to use UIViewController instead of UITableViewController.
in this way your bottom TableView Cell always stay visible while first TableView can scroll with more cells.
I would like to have a custom section design for my app.
The particular case would be to have a text displayed on the left of the section elements.
Could someone help? i've attached a image to better explain what i mean.
UPDATE 1
Let me elaborate: I would like to have a uitableview with N number of sections, each with variable number of elements per section. For each section, i would like to have a description on the left of the rows. The scroll show act as in any other uitableview.
You must have a table view, in each cell in the left side add a label and on the right side add a new tableview.
I want to create a view, such as the attached picture, which looks like a splitview.
In the left view, this is a catalog list, like a content. Once a row is selected, its subitems are displayed in the right view.
http://zwbaike.com/IMG_1746_meitu_1.jpg
[The desired view, the left column lists the catalogļ¼ the right column displays items which contain in the left catalog]
I used two tableview, one narrow tableview on the left, one wide tableview on the right. Both was controlled by one UITableViewController, by tag.
However, I cannot deal with the data source. The right tableview datasource should depend the left tableview selected row, but it didn't. And I have no idea how to do.
I want some suggestion with sample code, Thanks very much !