Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4030632
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:29:46+00:00 2026-05-20T11:29:46+00:00

Original question is below. I fixed my problem. I had the same view controller

  • 0

Original question is below.
I fixed my problem. I had the same view controller set for the tableview and the mapview. AND I had all of my mapView init in viewDidLoad. These both together made the following problems for me:

1) When the tab bar controller was presented modally and I received a memory warning the viewDidUnload was called (which I did nothing in before). When the modal tab bar controller was dismissed and viewDidLoad was called, it reset my mapView.
2) When the tab bar controller was presented modally and I received a memory warning before moving to the tab with the view controller and then switched to that tab, my viewDidLoad was called in my mapView’s controller which reset my map, AND it didn’t reset the tables properties so that my tableView would not work.

Much thanks to Anomie for helping me debug this issue, and gain a better understanding of how these pieces are all connected. Things work great now, and my App has a better design.

Original Question:
I have an application that has a mapview and when I present a tab bar view controller modally, every once in a while when I cancel the modal view controller the map resets back to the world view like a reset button was pressed on it. A few details:

  • This NEVER happens on the simulator
  • I notice memory warnings around the time this happens on my device
  • I do not do anything when memory warnings happen in my app, so nothing should have touched the mapview

Also, my tableview in my modal view controller sometimes shows up blank as well (aroudn the time of memory warnings). When it comes up blank, the methods normally called to get the number of rows, sections, and data are not called at all. Upon cancelling the modal view controller and re-opening it, the data is there fine, so the data is not getting erased..

Code I used to create the tab bar controller, picker and table:

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
// Display only a person's address(es)
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonAddressProperty],
                                                           nil];  
picker.displayedProperties = displayedItems;

UITabBarItem *peoplePickerTabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemContacts tag:0];
picker.tabBarItem = peoplePickerTabBarItem;

UITableViewController *tvc = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
tvc.tableView.delegate = self;
tvc.tableView.dataSource = self;
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:tvc];
UIBarButtonItem *uibbiCancel = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelTable)];
tvc.navigationItem.rightBarButtonItem = uibbiCancel;
tvc.title = @"Recents";
UITabBarItem *nvcTabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemRecents tag:2];
nvc.tabBarItem = nvcTabBarItem;

tbc = [[UITabBarController alloc] init];

NSArray *sections = [[NSArray alloc] initWithObjects:picker, nvc, nil];

[tbc setViewControllers:sections];

[self presentModalViewController:tbc animated:YES];
[nvcTabBarItem release];
[uibbiCancel release];
[tvc release];
[peoplePickerTabBarItem release];
[picker release];
[nvc release];
[sections release];
[tbc release];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:29:47+00:00Added an answer on May 20, 2026 at 11:29 am

    For your map view, what is probably happening is this: When a UIViewController is not being actively displayed (e.g. it is in a non-displayed tab of a UITabViewController, not the visible view in a UINavigationController, or is hidden by a modally presented view controller), it may release its view if a memory notification occurs. It will then recreate the view when needed.

    For your table view, I’m not sure. Are you assigning the data source and delegate to the table view in the code that creates the containing view controller, rather than doing so in the view controller’s viewDidLoad method?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The original question is below, but I changed the title because I think it
I've editing this original question as I think I've narrowed down the problem... I
Original Question I want to be able to generate a new (fully valid) MP3
Original Question I am looking for a function that attempts to quantify how distant
Original Question I am writting a logging class where the goal is to be
Original Question What I'd like is not a standard C pre-processor, but a variation
(The original question was asked there : http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832 ) Someone asked : While I
Due to a lack of response to my original question , probably due to
The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE
So here is the original query SELECT SUM(PickQty), SUM(ReqQty), AssignmentID, StopID FROM PickRequest GROUP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.