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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:02:21+00:00 2026-06-04T04:02:21+00:00

I am currently trying to change the maptype of my map (from MapsViewController) with

  • 0

I am currently trying to change the maptype of my map (from MapsViewController) with the help of a segmentedcontrol from another viewcontoller (BackgroundMapViewController). I use page curl to see the viewcontoller with the segmentedcontol (like the map app on iphone)
the problem is that I don´t know how to pass the information from my BackgroundMapViewController to my MapsviewController. (probably with delegation ??) I understood that you use delegation to give some “work” of an object to an other object, but I don´t know how I should use it here.
I would really appreciated if someone could help me out with my problem

(you can see a picture of the UI here: http://i50.tinypic.com/169masx.png )

MapsBackgrounsViewController.h

    @interface MapBackgroundViewController : UIViewController{
    IBOutlet UISegmentedControl *segmentedControl;
    MKMapType mapType;
    }

    @property (nonatomic) IBOutlet UISegmentedControl *segmentedControl;
    @property(nonatomic) MKMapType mapType;
    - (IBAction)segmentedControllChanged:(id)sender;

MapsViewController.m

    @interface MapBackgroundViewController ()
    @end

    @implementation MapBackgroundViewController
    @synthesize segmentedControl, mapType;

    - (IBAction)segmentedControllChanged:(id)sender {

    if (segmentedControl.selectedSegmentIndex == 0) {
        mapType = MKMapTypeStandard;
    }else if (segmentedControl.selectedSegmentIndex == 1) {
        mapType = MKMapTypeSatellite;
    } else if (segmentedControl.selectedSegmentIndex == 2) {
       mapType = MKMapTypeHybrid;
    }


    [self dismissModalViewControllerAnimated:YES];

}

MapsViewController.h

   @interface MapsViewController : UIViewController<MKMapViewDelegate,   UISearchBarDelegate>{
   @private
   IBOutlet MKMapView *map;
   //some other outlet
   }

   @property (nonatomic, retain) IBOutlet MKMapView *map;
   @property (nonatomic, retain) IBOutlet  UISearchBar *searchBar;
   //some other actions and properties
  • 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-06-04T04:02:23+00:00Added an answer on June 4, 2026 at 4:02 am

    You don’t need to store mapType, just set it directly in the map view:

    @interface MapBackgroundViewController ()
    @end
    
    @implementation MapBackgroundViewController
    @synthesize segmentedControl, mapViewController; // Connect mapViewController to your other view controller
    
    - (IBAction)segmentedControllChanged:(id)sender {
    
    if (segmentedControl.selectedSegmentIndex == 0) {
        self.mapViewController.map.mapType = MKMapTypeStandard;
    }else if (segmentedControl.selectedSegmentIndex == 1) {
        self.mapViewController.map.mapType = MKMapTypeSatellite;
    } else if (segmentedControl.selectedSegmentIndex == 2) {
       self.mapViewController.map.mapType = MKMapTypeHybrid;
    }
    
    
    [self dismissModalViewControllerAnimated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to call a method from my view to change a
I'm currently trying to change my cakephp login from using the username field to
I'm trying to change the current directory from C: to Y: I tried: import
I'm writing some Javascript code and I'm trying to change the current page as
Im currently trying to downlaod a audio track from a WCF, i need some
I'm currently trying to create a navigation based application, pushing views to change the
I'm currently trying to change the default behaviour of a multiselect element, so that
I am currently trying to change the language according to the user choice for
I'm currently trying to add the facebook apps request from our java server using
Hi I'm currently trying to use the elem function in prelude. data MyType =

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.