I am making an app where in if I tap on a cell of a table, I get navigated to another view. I am posting some data on that page but when I tap on the back button, the records are not updated. I understand it is because, I get the same view from the navigation controller. Can you suggest me a way to reload the data content in this case
In viewWillAppear:animated:, try this:
[tableView reloadData];
Related
I have a navigation view that contains a tableview. If one of the tableview items is clicked, the navigation controller passes the user to the detail view.
This usually works perfectly. However, if the user clicks the back button from the detail view and moves back and forth between the tableview and detail view too quickly, the app will sometimes become glitchy.
This glitch occurs rarely, but when it does, the back button makes the view transition to the left, but it just shows the detail view again. Then I need to press the back button again in order to actually go back to the list view.
Does anyone know why this might be happening? Or is there a bit of code I can post to help resolve this? Thanks!
Try this:
//in viewwillappear
appDelegate.window.userInteractionEnabled = FALSE;
[self performSelector:#selector(userInteraction) withObject:nil afterDelay:0.5];
-(void)userInteraction
{
appDelegate.window.userInteractionEnabled = TRUE;
}
Is it possible after selecting a cell in the table view and hitting the back button on the following view controller to arrive at the same place in the table? I don't like how it goes back to the top, especially because of the size of my table.
You should get the last touched index for the cell, and use
[tableView scrollToRowAtIndexPath:DESIRED_INDEXPATH inSection:indexPath.section]
atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
When you return to your previous view controller.
#ravi was right. Normally, the position of cell in table view won't change after pop up from decedent view controller. I'm afraid you setting up the table view in viewWillAppear what cause the table view to be recreated or reloaded everytime the view appear. If there some code inside viewWillAppear, try moving them to view did load.
I am making an application which has a main TableView in which every cell has details. when cell is clicked DetailView of that cell shows details. DetailView also has next and prev button from which we can go to next cell information without going back to main TableView. I want Back button in DetailView to work like that whenever i ll click it, application should show main TableView. Is there any way to do that?
I think i didnt explain my problem well. I have items in main TableView cells. and every cell creates a detail view when i click on that. there are next and previous buttons in every detailview so we can check next item details without going back to main table view. there is a back button on every detail view. for example if u clicked 3rd cell to see details. and then u went to 4th item's detail by using next button. now if u ll click back button it ll go back to 3rd view detail not the main table view. i wanna go back to main table view whenever i ll click back button. thats the problem.
s u can do this by
[self.navigationController popViewController:YES];
through this without using back button. when u click on cell detailview, it goes back to the view
Main view is called Root, use this
[self.navigationController popToRootViewControllerAnimated:YES];
Have you tried to push the detailview like this:
YourDetailView * detailView = [[YourDetailView alloc] init];
[self.navigationController pushViewController:detailView animated:YES];
[detailView release];
I am using presentModalViewController to display a view which allows the user to modify data that is being displayed in the first view. After the user has updated the data, I would like to send [tableView reloadData] to the first view.
Is that possible? Or is there a method I can create in the first view that gets called when the modalView is dismissed.
It should fit perfectly for your needs
Method for when the modal view has been dismissed
EDIT: syntax errors :)
I have a UINavigationController that gets UIViewControllers pushed onto it. In the first view there is a grouped table view which has 3 rows, each containing a UITextField with initial text set on viewWillLoad of that view controller. Tapping any one of the table view cells pushes the 2nd UIViewController onto the nav controller's stack. Each of the secondary view controllers has another table view where the user can select a choice by touching one of the rows.
The experience is identical to the iPhone's ical, when selecting "repeat" for an event.
The problem is that when the user touches the UIBarButtonItem to save, and I set the selected value into the previous views text field, the text field doesn't update. Regardles of what text I set it doesn't update when the navigation controller pops back to the first view. Could it be cached, or the view cached as a whole?
I'm logging all the values and everything looks correct.
Sorry to not post any code, I'm not sure how to without posting a book.
You could do a reloadData when the main view reappears. This forces the table to refetch the visible rows and redraw them.
[theTable reloadData];
Edit: an improvement would be to only reload the row affected, instead of reloading all the visible rows with the reloadRowsAtIndexPaths:withRowAnimation: method.