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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:12:08+00:00 2026-06-09T16:12:08+00:00

I connected a UISegmentedControl object from the .xib file to the corresponding IBOutle UISegmentedControl

  • 0

I connected a UISegmentedControl object from the .xib file to the corresponding IBOutle UISegmentedControl ivar in the ViewController.h. Then I put this method in the ViewController.m:

-(IBAction)switchMapTypes {
    if (switchMapTypes.selectedSegmentIndex == 0)
        [worldView setMapType: MKMapTypeStandard];

    else if (switchMapTypes.selectedSegmentIndex == 1)
        [worldView setMapType: MKMapTypeSatellite];

    else if (switchMapTypes.selectedSegmentIndex == 2)
        [worldView setMapType: MKMapTypeHybrid];
}

Will this cause a retain cycle if I link this method back to the UISegmentedControl object in the .xib file? Or am I completely misunderstanding what a retain cycle is?

  • 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-09T16:12:10+00:00Added an answer on June 9, 2026 at 4:12 pm

    A retain cycle happens when an object owns another object that in turn owns the first. Your segemented control doesn’t claim ownership of the view controller — hooking up an IBAction has no ownership consequences — so there’s no cycle here.

    There’s a style issue, though. You appear to have a method which is not a getter that has the same name as an ivar, switchMapTypes. You should not use the same name for two such different things. Also, your ivar name should really be a noun, and the method (which is an action) a verb. I would suggest mapTypesSwitch for the ivar and changeMapType for the action.

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

Sidebar

Related Questions

I connected to MySQL from PHP using root user. Connection object was $con .
I have my pc connected to my television and I use this so I
I have a UISegmentedControl within a view both within a xib. In my app
I connected to Amazon's linux instance from ssh using private key. I am trying
I connected to a particular server in c# using xmlaClient object. Now i want
Given connected line segments A->B->C->D (A->B is a line segment, then B->C is another
I have wifi connected in the devices - so this is ruled out. The
It is connected to BI and merging of data from different data sources and
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
Connected rewindButton with playButton programmatically. rewindButton is simply rewinding and playing from the beginning

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.