Xcode: detect identifier row selected - xcode

My project contains two designs for cell in a uitableview and show it correctly, but the problem is when I select a row for pass to detailsviewcontroller with a segue...
How can I detect the identifier of the selected row?
Depends on the selected row... In didselectrowatindexpath needs redirect to other detailsviewcontroller.
Thanks for all ;)

If you have access to the selected cell, you have access to it's "reuseIdentifier" (the documentation for which I've linked for you here).

Related

xamarin.forms devexpress grid selected row

I am using the GridControl from devexpress in my Xamarin.Forms. When the page is first displayed it has the first row selected automatically. How can I change this so no row is selected?
By looking at the documentation directly you can find your answer:
https://documentation.devexpress.com/#Xamarin/CustomDocument12264
It seems you need to set the SelectedRowHandle property to change the selected row.
https://documentation.devexpress.com/#Xamarin/DevExpressMobileDataGridGridControl_SelectedRowHandletopic

View based NSTableView: how to get the clicked row index?

When right clicking on a cell view in a view based table view with an assigned menu the cell's row gets a blue outline and the context menu appears. How do I get the index of that row? The property clickedRow only works for cell based table views.
Note: my question is significantly different in that I need a solution for menu updates es explained previously:
I need the clicked row in the menuNeedsUpdate function when creating the new menu.
It appears that clickedRow indeed also works for view based table views, but it's not yet set in menuNeedsUpdate. So it cannot be used to adjust the items in the menu (e.g. show specific items only that apply to the clicked row). However, you can use the menu validation to enable/disable entries (there the clicked row value is set finally).

Selection is not getting highlighted in my NSTableView table

I have a view-based table in my app. Everything works good except that when I click on the table entry the row/column I get the click and the content of my pick is sent to corresponding method, but the row is not getting highlighted.
I'm curious why is that, and can the problem be that I have a view-based table, not cell-based?!
Try this:-
- (void)selectRowIndexes:(NSIndexSet
*)indexes byExtendingSelection:(BOOL)extend
check whether u have set the empty selection or not. if u didn't set it in code check in nib properties or try by setting this setAllowsEmptySelection:no By default setAllowsEmptySelection is YES
I found the answer to this question here thanks to Peter Hosey
How to select items in NSOutlineView without NSTreeController?

How to know when NSTableView is done (re)loading its contents?

I have a UI that looks similar to the mail app. A table view along the left with a single column of items. When one of the those items on the left is selected, details about that item are shown on the right.
When some event occurs in my app that requires the data in the left table view to be reloaded, the current selection is lost and then the right detail view and left master view get out of sync.
The way i hoped to solve this problem was, when it was time to reload the table data, I would:
1. Save the current selected item
2. reload the table data
3. Handle a delegate method or notification that let me know when the reloading was done.
4. Re-select the proper item by finding it in the new list of items in the table.
Unfortunately I cannot find any way to determine when the table is done reloading. Is there a. any way to figure this out, or b. a more elegant solution to this problem?
thanks.
update: In case my problem was unclear, imagine you are in the mail app and you have some message selected. That summary cell is shown as selected on the left, and the details of the message are shown on the right. Suppose new mail comes in which appear as new cells at the top of the table. How is the message you are currently viewing preserved, and not de-selected?
reloadData is something of a sledgehammer. 10.7 offers a better solution.
Instead of using reloadData, when you have new rows to add, use insertRowsAtIndexes:withAnimation: . When you have rows to delete, use removeRowsAtIndexes:withAnimation: . And, of course, if an existing row has changed, there's reloadDataForRowIndexes:columnIndexes.
These should remember the selection for you (at least, the equivalents on iOS do).
If you can't target 10.7, some of the other suggestions will probably help out. noteNumberOfRowsChanged may also be helpful but I've not actually used it.
You can save selection on tableView(_:shouldSelectRow:) then select the row right after you create the cell in tableView(_:viewFor:row:) using selectRowIndexes(_:byExtendingSelection:).
It is pretty reliable no matter how / when / how many times you reload the table.

Adding table cells with UIPicker values selected

I am struggling to think about the logic by how i can achieve this. Here's my question :
I am trying to add a picker view (plist) with 3 columns. wherein the second column is dependent on the first one and the third column independent.
say for example :
1st column: Country Name,
2nd column : State and
third with yes,no or both options.
Then click add button to save and display these selected values(of picker view).
I want to keep an add another button so that user can select another option from the picker view and display the selection again.
I wanted to know if later on the user wants to edit the selection made earlier than is it possible to auto-populate the options in the picker view for each of them, if selected, like, if i select first added value, then it will populate it in picker view, popping out from bottom and make changes and save it again.For e.g., If the user wants to change the value in third field later.
Sorry, but i am not getting, like is this possible or there is another way to do the same.
Thank you.
Yes, when you display the picker, you need to include code something like this:
// The first row in the first column should be selected
[myPicker selectRow:0 inComponent:0 animated:NO];
// Pick the second row in the second column:
[myPicker selectRow:1 inComponent:1 animated:NO];
// Pick the first row in the third column:
[myPicker selectRow:0 in

Resources