I want to hide(or notshowing) Selected row in tableview....
i am using [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
But its doesnot work.
Can anyone help me?
Do you want to remove it or deselect it? To remove it, you need to remove it from your datasource reference, then call
[myDelegate tableViewSelectionDidChange:NSTableViewSelectionDidChangeNotification];
More info is in the Table View programming guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/TableView/Tasks/UsingTableDataSource.html#//apple_ref/doc/uid/20000117
Related
First of all, I'm sorry for my English, but I hope you'll understand what I wan't to ask ;)
I'm creating an Iphone-App . There is a Table-View with Subjects ( like Maths, English, etc.). When I select a row, a new TableView appears with my grades ( A, A+, etc.). In this TableView, I can add new tests.
My problem is, when I created a test in a subject and I go back to the Subject-TableView and go again to the subject itself (So that I can see my individual tests), the TableView doesn't refresh every cel. So there are cells which aren't filled, until I add a new test.
Do you have any idea what I can do? :)
Thank you very much!
rry to put [myTableView reloadData]; inside your viewWillApear as below:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[myTableView reloadData];
}
in your viewWillAppear do this
[myTableView reloadData];
Say I have an iPhone app using a tableview. As shown below, if I click the edit button I go into edit mode. Then I have the option to delete or add. So far so good, and all of my code is working. However, what about modifying one the the cells?
The first cell, for example, is Chevy. Say I want to change it to Ford. How can I edit a cell's value while in edit mode?
Is there another button I can add called "Change"? If so what would the code be for this?
Having looked around Google I can't find any results for this type of question. Does anyone know any good tutorials? Or at the very least, can someone provide some ideas and perhaps code samples to get started?
Depends how you want the user experience to be. One option would be to use the TableView delegate method didSelectRowAtIndexPath to take the user to another page with a text field and a save button.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UIViewController* myEditCarDetailsViewController = [[UIViewController alloc] init]
[self.navigationController pushViewController:myEditCarDetailsViewController animated:YES];
}
Once the user clicked save, you just need to update the datasource and call reloadData on the tableView.
Another option would be to make a custom tableView cell that has a textField in it that you set to editable when the table is in edit mode.
I'm guessing you were hoping for an in built apple way. I don't know of one, but it may exist
I have a UITableView displaying a set of options from which the user will select. When a row is selected the table will update to add a checkmark to that row (and remove it from all others). All is good so far.
What I want to do is close the view after the user makes the row selection but I want the tableview to update first so that the user can see the checkmark move to the correct row (however briefly this may display for).
If I do the following:
[myTableView reloadData];
[parentView closeDialog];
the table update will not show, the dialog will simply close. Any help would be appreciated.
Use this technique to call closeDialog after a delay
//afterDelay parameter represents number of seconds to delay the method call
[parentView performSelector:#selector(closeDialog) withObject:nil afterDelay:1.0 ];
Add self prefix and add some delay using performselector
[self.myTableView reloadData];
[parentView closeDialog];
Hope, this will help you..
Sometimes tiny looking problem is ignored to handle in the last but you never know that will become nightmare for you, happening with me.
Thanks in advance, problem my app's settings page contains tableView and every setting element is one of the view. One of the setting item (row) offers show expands a few list of items in another listTableView. After making a selection in listTableView when i come back to my settings tableView using navigationItem.leftButton (Back), selected item value overlaps the previous item's value, in the sense [tableView reloadData] in viewWillAppear works fine but tableView rows are not fresh drawn. It doesn't refresh the cell's UI.
Note that if settingTableView has any subview like UIButton etc it has the latest value, i can use that as workaround but the only problem is when is select this row again Selection has old value that overlaps new value on selecting the row.
I will appreciate any suggestion or sample code using will be great help.
Thanks a ton
Amit Singh
Use [tableView reloadData]; in your viewWillAppear method.
or use [tableView reloadData]; in viewDidAppear method
The problem you are facing is perhaps due to portion of cell that is reusable and the one that is not reused. Check out the code you are writing inside the block of
if(cell==nil){}
components you have created inside block will not get recreated and others might be recreating causing the overlapping on the cell.
In my case, I had to use [self.tableView reloadData]; rather than [tableView reloadData]; in the viewWillAppear method.
I am trying to do something interesting.
I am pulling some JSON data and populating cells in a UITableView. How can I make the UITableView scroll ever second or so? I want to give the effect that as new data is coming in, the table is scrolling, so it is streaming.
Any ideas?
Yes, use scrollToRowAtIndexPath:atScrollPosition:animated:.
You could also use UIScrollView's scrollRectToVisible:animated: if you want to have more finegrained control and can calculate exactly what your scroll position should be in pixels. (UITableView is subclass of UIScrollView.)
But if you are just adding cells, sounds like you could also just use insertRowsAtIndexPaths:withRowAnimation:, this is also "interesting."
Just do this
[table reloadData];
NSIndexPath *myIP = [NSIndexPath indexPathForRow:[arrayIn count]-1 inSection:0] ;
[table scrollToRowAtIndexPath:myIP atScrollPosition:NULL animated:YES];
in anywhere where arrayIn is your array by which your table populate.
you can use uitableviews scrollToRowAtIndexPath to do this....heres a link reference
You can call this method whenever as youd like to scroll your tableview
And you can call performSelector:withObject:afterDelay: for the timer effect - although if you are really pulling in data every second, it's best to just reloadData as you go.