Changing position of the table view when navigated between views - iphone

I have a table view in one of my view, I scroll down to the bottom of the table and then if I load another view which also has table view, Table view is not changing its position.
For Example:- If i am scrolling my table to its bottom and from there if i navigate, the new view having table view shows me bottom of table.
Instead I need to show the top of the table.
Please suggest me,earlier it worked fine in< iOS 5.
Thank you
Narasimha

When You push the view
In view will appear try
-(void)viewWillAppear:(BOOL)animated {
[self.tableview selectRowAtIndexPath:Nil animated:YES scrollPosition:UITableViewScrollPositionTop];
}
Hope this helps.

Related

Table view cell is overlapped by navigator bar

I have embedded navigation controller and created a table view controller. I have problem when running this in simulator. The top of table view cell is hidden by navigation bar. However, it works well after I go to next page and return back.
Try with this
tableView.contentInset = UIEdgeInsetsMake(44,0,0,0);
Hope it helps

Table View Go To Same Place After Selection

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.

UISplitViewController StoryBoards segue to replace detailview

My storyboard that has the UISplitViewController as the initial view controller. Its master view has a UITableView embedded in a navigation controller, and there is a detail view controller which contains a MKMapView. Clicking on the table cell of the first table view segues into second table view controller.
Clicking on the cell of the second table view segues into second detail view, which is an image view. The segue type is "Replace" with the destination of "Detail Split". Basically, it loads up the image related to the row in second tableView in the detail view.
I am able to navigate back to my first tableview fine. I want to display the first detail view
when the first table view shows up. The reason being that it displays a map view which is related to the contents of the table view. I read quite a bit about it but did not figure out on how to do that. Your help will be really appreciated.
Have you tried adding the following to your first TableViewController
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// existing code if you have any
[self performSegueWithIdentifier:#"Segue ID for your map" sender:self];
}

Add a background image to tables in a navigation view in a tabbed application

I have a tabbed application which then has a navigation controller. In each the navigation controller I an a table View Controller which obviously contains a table. I push a new table view controller from this one.
I want to put a background to the table but can only add an image infront of the table. I think this may be because I am adding the sub view in the table view controller, but I don't seem to be able to add it anywhere else.
Please could you help me, thanks.
Try setting UITableView.backgroundView to say UIImageView of your choice and if that's not helping you too much, try setting the UITableViewCell.backgroundView for each of your cell to something similar. As far as I remember the UITableViewCell is opaque and the UITableView is not necessarily seen under it.
I have used a view controller to add the uiimage view then the table view controller view too. This gets the desired visual result, but the table is no longer in the navigation stack so when you clikc on the cell it doesn't push the nav controller.
Is there a way to talk between the table view controller and its view controller?

Why isn't my UITableView appearing in the correct scroll position?

I have a split view-based app that presents a master-detail interface, and uses a popover to present the master list when in portrait mode. The popover presents a sectioned table view that ultimately gets populated by a subclass of NSFetchedResultsController. I can tap the tool bar button to present the master list, scroll to whatever row, and tap the row to dismiss the popover.
My problem is that if the table is scrolled past the top of the second section, when I dismiss the popover and then later tap the toolbar button to re-present it, the table's scroll position is always set such that the first row of the second section is at the top of the list. If I haven't scrolled past the top of the second section, it correctly remembers its scroll position when the table is presented again.
Similarly, in landscape mode, if I scroll the table past the top of the third section and then rotate to portrait, when I come back to landscape the scroll position is always set such that the first row of the third section is at the top of the list.
I tried calling -scrollToNearestSelectedRowAtScrollPosition:animated in both the master view controller's -viewWillAppear, as well as in the split view delegate's splitViewController:popoverController:willPresentViewController:, to no effect. Anybody have a clue what I might be doing wrong?
Did you try storing tableView.contentOffset?
CGPoint offset = tableView.contentOffset;
...
...
...
[tableView setContentOffset: offset];