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
Related
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 currently have a List TableView where I can place check marks on any of the Products in that list. Right now, there is no outlet to handle the check marks. What I'd like to do is once the user places check marks on Product names in that list, press a button which would pass those Products' details over to a new tableview, displaying the details of those Products in a side-by-side column-type of tableview for a side-by-side comparison of the 3 Products' details. I could really use some help on the following and any help provided would be much appreciated.
1) Take the check marks and press a button to send that to a new view. I have no idea how to associate and connect those check marks to a button and then program that button to send the details to a new tableview.
2) Create a new view with a tableview capable of displaying 3 side-by-side columns in a tableview. I have read some about creating tables that appear to have multiple columns, but I'm not exactly sure how this is achieved.
Any help would be much appreciated. Thanks.
I'm not sure about number 2, but here's how I'd handle number 1:
Store the "check mark" as an attribute of each Product object in the array where your first table view is getting its data. Then, when you push the next view controller, populate an array by checking which products have a check mark attribute and adding them to a new array for your second table view's data source.
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.
I built an app with a table view that holds frequencies and other data. I would like to select a row, edit it, and then add the new frequencies info to a new row right below the selected row without deleted the selected row.
I'm using core data. Everything works fine using UIBarButtonItem *saveButton method. But it just replaces the row. I also can use add but it puts the new row on the bottom of the tableview.
insertRowsAtIndexPaths:withRowAnimation: will put the row in. You'll have to figure out how to put the right data in it in cellForRowAtIndexPath