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

  • Home
  • SEARCH
  • 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 804509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:55:54+00:00 2026-05-14T23:55:54+00:00

I have a UINavigation scheme with a welcome page, a middle page, and a

  • 0

I have a UINavigation scheme with a “welcome” page, a middle page, and a detail page.

In the middle page, there’s a segmented controller that can swap the main body of that page between a table, a calendar, and a MKMapView, each implemented with their own view controller classes.

Today I implemented the MapView and its annotations and all of that. It’s nice. And a detail disclosure on each callout takes you to the detail page just the same way as if you’d gotten there via the table. Lovely.

I also have a right-button-bar button that pushes in a “search” view. From there you can search the data I’m navigating. When it’s done filtering the data (an array of objects I’m keeping in a data singleton), it makes the table reload its data, and calls my annotation-clearer-and-builder methods on the map view, and then pops itself out, so the “middle” page (including whatever view was in the guts of it) is back on the screen.

Problem is, if I go back and forth between the map and the search a couple times, any mention of the table view causes us to crash with: *** -[CALayer retain]: message sent to deallocated instance 0x710b810. (I obviously have NSZombies turned on.)

I put an NSLog in the dealloc method of my table view controller. That thing’s never getting called. I don’t know if we’re ditching it behind the scenes for memory purposes, or if I’m leaking it and can’t get my hands back on it, or what. I’m sort of at a loss about where to look. Any hints?

EDIT:

Here’s the code where I swap in the controllers for the main view of my “middle” viewController:

- (IBAction)switchView:(id)sender
{
    UISegmentedControl *seg = (UISegmentedControl *)sender;
    NSInteger choice = [seg selectedSegmentIndex];

    NSArray *array = [mainView subviews];
    UIView *oldView = [array objectAtIndex:0];
    [oldView removeFromSuperview];

    if (choice == 0) {
        if (!self.tableController)
            self.tableController = [[EventsTableViewController alloc]
                    initWithNibName:@"EventsTableView" bundle:nil];
        [mainView addSubview:self.tableController.view];
    }

    if (choice == 1) {
        if (!self.calendarController)
            self.calendarController = [[EventsCalendarViewController alloc]
                        initWithNibName:@"EventsCalendarView" bundle:nil];
        [mainView addSubview:self.calendarController.view];
    }
    if (choice == 2) {
        if (!self.mapController)
            self.mapController = [[EventsMapViewController alloc]
                        initWithNibName:@"EventsMapView" bundle:nil];
        [mainView addSubview:self.mapController.view];
    }
}

Per Adam below, I am doing removeFromSuperview there. I tried sticking in a retain on oldView just before removing it, but that didn’t help.

Thanks!

  • 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-14T23:55:55+00:00Added an answer on May 14, 2026 at 11:55 pm

    I found it. On my search view controller I passed in a reference to the UITableView on the previous view, so I could call refreshData on it after filtering my source data.

    I set it as a property (nonatomic, assign), which seemed right, but then at dealloc time, I went right on ahead and said [theTableView release]. This is actually the second time I’ve had mysterious and long-standing bugs crop up because I over-released something. I plan to actually learn this time.

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

Sidebar

Related Questions

Have a build process that can't be edited and need to pack another war
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal
Have a look at the menus on this page: http://www.pieterdedecker.be/labs/vspwpg/?page_id=96 They look okay in
have a table that dynamically generates text boxes in run time. I want to
I'm displaying a popover in iPad with a UINavigation bar. On the second view,
Have I correctly added an element to a hashTable? Flows flows = new Flows(sIP,dIP);
Have you seen library for flexible working with terminal(Unix like)? I want to implement
Have following setup: MainActivity class - extends activity MyLayout class - extends View Prefs
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
have anyone seen a Solr plugin example written in Clojure? I guess it should

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.