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 6733807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:48:49+00:00 2026-05-26T10:48:49+00:00

I am building a Tab Bar App and have a MapView set up on

  • 0

I am building a Tab Bar App and have a MapView set up on one of the tabs.

I’ve converted this over from a View-Based Application which worked perfectly so I know that it’s mostly set up correctly.

Each pre-placed pin on the Map has annotations and a leftCalloutAccessoryView that links to the DetailViewController. What I want is for the callout screen (Detail View Controller) to just show up in that same tab but when I click on the left callout button the program crashes.

The method I’m using for touching the Callout Accessory is this:

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view 
calloutAccessoryControlTapped:(UIControl *)control
{
    MillersLocations *annotationTapped = (MillersLocations *)view.annotation;

    NSLog(@"button clicked on annotation %@", annotationTapped);

    LocationsViewController *thisMap = (LocationsViewController *)[[UIApplication sharedApplication] delegate];
    DetailViewController *dvc = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil];

    dvc.title = view.annotation.title;
    dvc.addressString = view.annotation.subtitle;

    [thisMap switchViews:self.view toView:dvc.view]; //This is the line with the error message
}

On the line ‘[thisMap switchViews:self.view toView:dvc.view];’ I get a SIGABRT error. And the errors:

2011-10-25 14:11:11.465 Miller Tab Bar[56230:207] -[Miller_Tab_BarAppDelegate switchViews:toView:]: unrecognized selector sent to instance 0x5835530
2011-10-25 14:11:11.467 Miller Tab Bar[56230:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Miller_Tab_BarAppDelegate switchViews:toView:]: unrecognized selector sent to instance 0x5835530'

Is the switchViews method invalid in a Tab Bar app? If so, what method is generally used in a Tab Bar app to switch views within a certain tab? Thanks for the help, I’m still learning!


EDIT

I realized I’m calling it to ‘self.view’ so here’s how I’ve updated the code. I had LocationsViewController set as the delegate because of copy and paste error.:

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
    MillersLocations *annotationTapped = (MillersLocations *)view.annotation;

    NSLog(@"button clicked on annotation %@", annotationTapped);

    LocationsViewController *thisMap = [[LocationsViewController alloc]initWithNibName:@"LocationsViewController" bundle:nil];
    DetailViewController *dvc = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil];

    dvc.title = view.annotation.title;
    dvc.addressString = view.annotation.subtitle;

    [thisMap switchViews:self.view toView:dvc.view];
}

Now I don’t get the error but it doesn’t switch views. It logs out and everything but doesn’t go anywhere. The method is declared in LocationsViewController.h and implemented in LocationsViewController.m. Why wouldn’t it be linking to anything?

  • 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-26T10:48:50+00:00Added an answer on May 26, 2026 at 10:48 am

    If the callout method is in the same class as switchViews then you don’t need to / shouldn’t create a new instance of LocationsViewController inside itself. Instead of [thisMap switchViews..., it should just be [self switchViews....

    However, without knowing exactly what that method does, I can’t be sure it will do what’s expected (eg. what will it do with the self.view passed to it–will it be able to switch back).

    Just a couple of other alternatives (among many) whether you’re using a tab bar or not are:

    • Show the detail view as a modal view controller. This is easily done by:

      DetailViewController *dvc = [[DetailViewController alloc] init...
      dvc.title = view.annotation.title;
      dvc.addressString = view.annotation.subtitle;
      [self presentModalViewController:dvc animated:YES];
      [dvc release];
      

      The modal view would be dismissed using [self dismissModalViewControllerAnimated:YES];.

    • Put a UINavigationController in the maps tab and make LocationsViewController the root view controller of that navigation controller and push the detail view controller. The detail view would then be popped when done. Implementing this requires a bit more work but will allow the user to use the other tabs even while the detail view is showing on the map tab.

    I suggest going through Apple’s View Controller Programming Guide as well as their introductions to the language: Learning Objective-C: A Primer, and The Objective-C Programming Language.

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

Sidebar

Related Questions

I am building a tab bar app one of the tabs has an image
I'm building an app that combines tabbar and navigation bar. In one of tabs,
I'm building a simple Facebook tab. I have two tabs that change every 3
I have made a Tab Bar app and have added a UIPickerView in the
I'm building a Tab Bar app, pretty all GUI modeling is done with IB.
I'm building a tab bar application in which there are three tabs, each of
I'm building an application based on the Utility template from Xcode, to which I
I am well into building a Core Data tab-based iPad application. I am passing
I am building a tab for a Facebook page, and this tab contains the
I'm in the process of building a sports team app and have created my

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.