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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:50:40+00:00 2026-06-15T21:50:40+00:00

I want to add SegmentedControl to my MKMapView With three Segments StandardView SatelliteView HybridView

  • 0

I want to add SegmentedControl to my MKMapView With three Segments

  1. StandardView
  2. SatelliteView
  3. HybridView

and we can change map type by taping segments

i have try some code

- (void)indexDidChangeForSegmentedControl:(UISegmentedControl *)aSegmentedControl {

NSArray *itemArray = [NSArray arrayWithObjects: @"One", @"Two", @"Three", nil];
segControl= [[UISegmentedControl alloc] initWithItems:itemArray];

if((segControl.selectedSegmentIndex = 0)){
    _mapView = MKMapTypeStandard;
}
if((segControl.selectedSegmentIndex = 1)){
    _mapView = MKMapTypeSatellite;
}
else {
    _mapView = MKMapTypeHybrid;
}

}

  • 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-15T21:50:41+00:00Added an answer on June 15, 2026 at 9:50 pm

    Hey try with this condition segControl.selectedSegmentIndex == 0 instead of this segControl.selectedSegmentIndex = 0

    here problem with single = sign

    and Also try like this bellow code..

    - (void)viewDidLoad
    {
          segControl = [[UISegmentedControl alloc]initWithItems:[NSArray arrayWithObjects: @"One", @"Two", @"Three", nil]];
          [segControl addTarget:self action:@selector(indexDidChangeForSegmentedControl:) forControlEvents:UIControlEventValueChanged];
          [segControl setFrame:CGRectMake(50,20,200,44)];//set frame which you want
          [self.view addSubview:segControl];
    }
    
    - (void)indexDidChangeForSegmentedControl:(UISegmentedControl *)aSegmentedControl {
        switch (aSegmentedControl.selectedSegmentIndex) {
                case 0:
                    map.mapType = MKMapTypeStandard;
                    break;
                case 1:
                    map.mapType = MKMapTypeSatellite;
                    break;
                case 2:
                    map.mapType = MKMapTypeHybrid;
                    break;
    
                default:
                    break;
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website built with ASP.NET (3.5) and want add some level of
I have a list of string values that I want add to a hashtable
I have problem, when I want add Node to my GUI from other Thread.
I have numbers in javascript from 01(int) to 09(int) and I want add 1(int)
I have a report that I want add a line beneath the even rows
I have libTestLibrary.so library and I want add it to Android-emulator's lib folder. How
Why i have an error in my web.xml when i want add servlet..? <servlet>
I just want to add a tableview to the key window,but i can't see
I've created new content type. And I want add new custom non-standard field. The
I have upgraded my SugarCRM 5.1 to 6.5.2. Now i want add Zukars_Hierarchy module

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.