Differentiate between no selection and selection at index 0 in UITableView - ios4

I have a UITableView and a UIButton. When the UIButton is pressed, it prints the text of the UITableViewCell that is selected to the console output.
However, when no selection is made on the UITableView, it defaults to row 0, and displays this text.
How can I determine if there is no selection made, so that I can bring up a UIAlert?

Perhaps you can try storing the index of the cell when the didSelectRowAtIndexPath: method triggers. That way you can keep track of whether the user has selected a row since the view has been shown

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)

Gtk : Make a pixbuf cellrenderer editable

I want to make a combobox of pictures inside of a treeview cell (the cell must render the selected picture)
I tried these solutions :
Make a cellRendererComboNew in the column. The cells are editable but the combobox render only Strings!
I used the editingStarted signal to detect the edition of the cell and create a combobox with pictures in this cell. It Works fine but the cell doesn't render a picture!
I tryed to make a cellRendererPixbufNew in the column and make these cells editable (clickable,selectable) and use the editingStarted signal the same way as previously. But pixbuf cells are not editable!
I tryed to change the cellMode property of the cells with
set render [ cellMode:= CellRendererModeActivatable ] to make the signal editingStarted to be emitted when clicking on the cell. But it doesn't work!
My questions are :
Is it possible to make a pixbuf cell renderer editable? And what is the correct way to do it?
Is it possible to detect the left click on a treeview cell and replace the widget inside this cell like with editingStarted ?
Do you have an example in Haskell? Python? or any language?
Best Regards.

In wpf what is difference between Text and SelectedValue properties of a combobox

I am new to WPF. I have a problem with ComboBox that is placed within a cell of a grid. I am using xceed grid control. Within the xcd:CellEditor tag, I have this ComboBox control. The combobox is populated with values properly with required value in it selected but when I click on the combobox, the selected value is cleared (showing empty selection) and I had to click on the dropdown arrow to display the list and select that value again.
This problem is occuring to me when I am using the Text property of the ComboBox but when I replace the Text to SelectedValue then I don't see this problem. Can anyone throw some light on this.
Following is what I have changed.
From Text="{xcdg:CellEditorBinding}" to SelectedValue="{xcdg:CellEditorBinding}"

Monotouch Dialog TableView.CellAt(...).Frame returns incorrect position if table has scrolled

I am having a problem using RootElement.TableView.CellAt(...).Frame to position a popover on the selected row of a table created by a mono touch.dialog controller.
Fram.Y returns the correct position unless the underlying table has scrolled. How do I get the true Y position of a "scrolled" cell?
I have used this code before on a UITableView without problems. What is different about the UITableView that monotouch.dialog creates?
Full Code:
var popPos = rootElement.TableView.CellAt(rootElement.TableView.IndexPathForSelectedRow).Frame;
Thanks.
You'll have to add/substract UITableView's (inherits from UIScrollView) ContentOffset.Y to/from the Y position you retrieve from the cell. That contains the current scroll position of the the table.

textField in a tableViewCell clears the value when Scrolling off screen

I have a textField inside a tableViewCell. I recently noticed that if I enter a value in the textBox, and then scroll the cell off the screen, the value in the textbox disappears.
please someone help me out for how to store the values temporarily.
Thank you in advance
Bks when scroll back, in datasource function cellForRowAtIndexPath, the textfield is reused.
So what u need to do is save the textbox's text value while editing, and assign the value to this textbox(or should call it textfield) in cellForRowAtIndexPath.
see the UITextfield delegate function:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

Resources