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 !
Related
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.
In my app I would like to have custom cells in my table view that displays a row of buttons that may display all buttons or fewer depending on data. The cell looks like this:
Some of the buttons may not apply to every cell so some cells may look something like this.
What are some ideas on how to structure this so only the buttons that are required show? If I hide a button the space remains. I would like all the buttons to start at the left and only show the ones that apply with no space in between.
Sounds like a job for a UIStackView. They are wonderful for managing sets of evenly spaced objects like buttons.
Put a stack view in your table view cell, and then have your tableView(_:cellForRowAt:) method remove any leftover buttons from the last time the cell was used and add the ones you need. You could even get fancy and manage an array of recycled buttons in order to avoid creating/destroying buttons each time a cell comes into view.
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 have a tableview that has a large number of fairly tall dynamic cells. I've tried creating the prototypes for these but I've run out of height room in the view.
I can't seem to extend the height of the table view, (or the view it's in). I also can't create the tableview outside the viewController, give it a larger height, and just link to it.
Suggestions? I know I can create the cells programmatically or from a separate nib, but I'd really like to do it via storyboard.
thanks,
Just figured this out myself. Try this:
Double-click the table almost anywhere except where there's an existing control. You can also double-click on the outer edge of the table.
Note that the table view will show a highlighted section that aligns with the cell you've clicked. You've entered some sort of selection mode.
Now use the mouse to scroll up or down. The cells will shift up or down as if you were running the app.
I want to do something similar to the left UITableView on imdb app on ipad.
Once you have selected an item, it will become the first item on the top and it will dock there. When you flick the list below, it will always be there.
Anyone has any suggestion on how I can achieve that?
That's not part of that UITableView.
It is a seperate UITableView with a custom UITableViewCell that is actually the same as in the UITableView with all the information about the selected film or character ...
When no film is selected, that second UITableView isn't visible. But as soon as you select an item, that UITableView at the top will become visible with the information about the selected item. That means that you will have to reduce the height of the UITableView (with the detail info about that item) so that the UITableView at the top will get some space for being displayed. Everytime you change the item, you need to update the UITableView using the general delegation and datasource methods for a table view. Once there's nothing selected, you just set the upper table view to hidden, and set the other table view's height to the full height.
That's all.