Insert SubView in TableView's Rows - xamarin.ios

I have made my UI through C# and not using xcode.
I have added a UITableview to my view(mainscreen) and want to insert a subview to each cell of the table.
The issue is i cant access the rows individually?
How do i fetch the row index number and add a subview to that row?

Use UICollectionView and custom cell subviews. Closest thing to flow layout if done correctly.
Or return custom UITableViewCell cells for the CellForRowAtIndexPath delegate calls.
(C# is GetCell() on tableview datasources)
You need to experiment with designing the views in xcode, and learning about springs and struts or auto layout tactics used in iOS.

Related

Implementing cell reuse for varying height cells in UITableView (iOS8+)

I have a custom cell layout, inheriting from MvxTableViewCell. One of the cell's contained views is a UILabel that supports text wrapping. The wrapping will mean the cells can be of different heights as that is driven by how much text is in each data item. The custom table cell is defined without any Storyboard or NIB. It is laid out in code and uses AutoLayout.
I am finding that the cells are being reused and the heights are staying the same as they were when they were previously used.
When the data source is updated and new items are in the table the previously taller cells are reused for cells that don't need that extra height. Do I need to create a custom MvxTableViewSource that has specific reuse logic? How would I even ensure that extra height rows were not reused?
I am hoping this is not a Monotouch and MVVMCross specific issue but just in case, this is how I am using the UITableView
this.searchResultsTable = new UITableView();
this.searchResultsTable.AccessibilityIdentifier = "SearchView_SearchResultsTable";
this.searchResultsTable.TranslatesAutoresizingMaskIntoConstraints = false;
this.searchResultsTable.RowHeight = UITableView.AutomaticDimension;
this.searchResultsTable.EstimatedRowHeight = 44.0f;
this.searchResultsTable.AllowsMultipleSelectionDuringEditing = true;
this.searchResultsTable.TableFooterView = new UIView();
The Table Cells display correctly on first use of the View but subsequent uses cause issues as does scrolling.
For example here is a screen shot of mixed height working followed by the same list after the taller row has been scrolled off the screen then back on. The red boxes show how box the cell should be (FWIW this is test data not real people's data)
Another example, here the table is again displayed correctly then loaded again with the same data yet the second load has the cell height incorrect
I broke my two issues into two questions however there is a solution for both this one and the other issue with this SO answer, UILabel not wrapping in UITableView until device rotate (iOS8)

iOS facebook sdk placepicker custom tableview cell

Is there a way to customize cells of tableview that placepicker uses, or just get data of nearby places and use them in my own UITableView?

javaFX textarea - columns/rows

The textarea-class in JavaFX should give me the option to add rows and columns, but the way I tried didn't work:
TextArea ta = new TextArea();
ta.setPrefRowCount(100);
ta.setPrefColumnCount(100);
I'm searching for columns/rows like in Microsoft Excel, inclusive the gridines.
.setGridLinesVisible(true);
doesn't work for this Type.
For use case similiar to Excel you're actually looking for TableView. Every table cell can contain anything, even another window so it is very flexible.
If you want grid lines on top of TextArea, but want to keep the standard TextArea behavior, you will have to combine the TextArea and TableView in a StackPane.
You will just have to clear the table's background using CSS.
However, matching the row and column sizes with the text will need some additional code.
Apologies for my English.
colums/rows like in Microsoft Excel, inclusive the gridines
TableView as recommended in Michael's answer is likely the right basic solution for.
There are some 3rd party controls you might consider which add some basic spreadsheet like functionality to the base JavaFX TableView control:
SpreadsheetView from the ControlsFX project.
TiwulFX from Panemu.

No section wrapping in UICollectionView

I am using UICollectionView to display cells but I would like to change the default wrapping behaviour in the sections. I don't want any wrapping, instead, I would like the equivalent of a variable width horizontal scrollview for each section, like shown in the following image.
I can do this using horizontal scrollviews within a vertical scrollview but I would like to use a collection view. Any idea on how to do this with a custom flow layout maybe?
Thanks!
You can nest collection views, but you have to be careful separating their delegates to avoid having one collection view being affected by a call to the other.
Create the first collection view with vertical scrolling and as many sections you like. Its delegate must be the controller view it is embedded in. Subclass its cell.
Inside the first collection view's cell create a second collection view with horizontal scrolling. Its delegate is the cell of the first collection view.
You can find an example here: Issue with nested UICollectionViews

UIPanGestureRecognizer on UItableCellView

I have added UIPanGestureRecognizer on UITableCellView. I want to drag one cell and reorder it inside uitableview. Basically I want to achieve the functionality given in iPad keynote slide reordering.

Resources