I have 15 rows in my table. When I select the first row and scroll to last row of the table, and come to back to the first row, my selection is reset. How can I fix this row selection reset issue when scrolling the table?
How are you selecting the row? Because of the table-cell reuse mechanism, just setting the selected property on an individual cell usually won't work; calling -selectRowsAtIndexPaths:animated: on the table view itself is the correct way to set its selection.
Related
I'm working with c, glade and gtk2
One column is editable. Editing one value, scrolling to no visible row and select (clicking) on one of this rows, the cursor go to one third row. The row selected is near edited value on the same row displayed position that clicked.
I think the problem is when GtkTreeView receives focus (end edition) set the display on the first value and after this is selected the row.
Is possible to force the selected/focused row to be displayed on GtkTreeView focus-in signal.
Try setting the selection mode to GTK_SELECTION_BROWSE, then one row should always be selected
I am trying to recreate functionality of similar to adding/editing phone numbers or emails in the contact editing on the iPhone.
I always have an empty row with placeholder text available. In edit mode (push of a button on toolbar) I un-hide UITextField. In 'editing changed' callback I insert a new row into the section, again similar to iPhone contact editing view.
However, after the insert when I start modifying 2nd row (3rd row is inserted as expected) the value of the 1st row text field is cleared to the placeholder value.
I have read somewhere that I would need to store the text field value in row 1, at the time of 2nd row insertion, and on end editing (I assume) otherwise it would be lost? This seems quite strange to me and I was wondering if this is the only way? At what point would I go back to restore it? This of course keeps repeating as I insert a new row and modify the last row's value values in all the rows prior are being cleared.
Can anyone point me to an example of similar to contact editing functionality? If I would change the way rows are inserted by having the last row always be a "+ Add Value" row, would that help? I would not think so.
Also, It would be nice if I could change style of the 1st row from UITableViewCellEditingStyleNone to UITableViewCellEditingStyleDelete, but no matter what i have attempted including toggling editing NO/YES in the middle setting all visible rows to react to ignore transitions I can not get it to work, to have all but last row with UITableViewCellEditingStyleDelete. So I thought ok fine let me have the initial row not able to delete (not what I wanted, but I can live with it).
Please confirm, but I am guessing from reading farther that scrolling rows out of view would result in the same problem, so on textFieldDidEndEditing as well as possibly on each insert in my case, needs to be handled to store "new" data in the corresponding entry of the Data storage array for each row.
However, in my case without scroll I would probably need to do:
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimat....
for all rows in the section being modified and possibly all visible rows. Confirmation are greatly appreciated.
Why reuse at all in your case?
If all the rows are on the screen at all times just create a new UITableViewCell for each.
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
configure content to go on it...
[cell.contentView addSubview:WHATEVER_YOU_CREATED];
[cell.contentView sizeToFit];
return cell;
Reusing cells is a way for those that have many rows to reuse the ones no longer visible to conserve resources.
I have a UITableView where I select multiple rows.
I want to be able to swipe and delete few of them.
As soon as I swipe a cell, All my selected rows become unselected.
This can not be obtained by using default cell behaviour..
Alternate way is
Whenever you select any cell add that rownumber in an array. reselecting it must remove that index from the array. Soon after select change the background of the cell such that it looks as selected.
I have a UITableView. It loads sets of events at regular time intervals. I want to be able to scrol the table view to see all events. I had inserted latest events at position number zero in a row. So whenever I reload the data, my table view has moved one row down. So the user can't view exactly what he wants to read. So I want to reload the UITableView without moving its scrolling position. How can I do that?
Note that my event text height should be vary based on events.
You can either use UITableView's -scrollToRowAtIndexPath:atScrollPosition:animated: or, probably better, UIScrollView's -setContentOffset:animated:, to reposition the table view. You'll probably just have to note the current offset, calculate the new offset (based on where & how many rows you added), and set it after you update the table.
I am having two tableviews if the 1st table row gets selected then automatically deselect the row in 2nd table if it is previously selected. Kindly anyone help me in this. Thanx in advance.
If you select a row in your second table you have to store the selected index in a variable of your view controller. Within
didSelectRowAtIndexPath
of your first table you send
deselectRowAtIndexPath
message to your second table. Storing the selected item in a variable may be unnecessary if you manage to receive the selected index in your second table otherwise