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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:32:38+00:00 2026-05-28T06:32:38+00:00

I have a UISegmentedControl within a view both within a xib. In my app

  • 0

I have a UISegmentedControl within a view both within a xib. In my app delegate I am creating the controller which is the file’s owner of the xib using initWithNibName: and then wrapping it within a navigation controller (UINavigationController initWithRootViewController).

Then I try to set either the image or title of elements within the segmented control like this:

[self.viewController.segmentControl setImage: [UIImage imageNamed:@"some_image.png"]forSegmentAtIndex: 3];
[self.viewController.segmentControl setTitle: @"some text" forSegmentAtIndex: 2];

The segmented control is appearing but the setImage: and setTitle: is having no effect.
The first two cells say First and Second respectively which are the default values assigned when initially drag/dropping it within IB.

segmentControl is an IBOutlet and I’ve confirmed its connected to the segmented control.

Why is it not working?

I can set the image or text in IB and it works, but I would like to understand why I cannot set them programatically.

(The segmented control has 6 indexes).

  • 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-28T06:32:39+00:00Added an answer on May 28, 2026 at 6:32 am

    Why are you setting up the segmented control in your app delegate? Shouldn’t you be adjusting it’s attributes in the file’s owner (viewController)? I would probably do this in viewController’s viewDidLoad method, or since you’re using IB anyway, simply set the image and title attributes there (in your XIB).

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

Sidebar

Related Questions

Have just started using Visual Studio Professional's built-in unit testing features, which as I
I currently have a UISegmentedControl set to add/remove table view cells when its value
I have a UITableView with custom cells that were defined in the xib file,
I have a uisegmentedcontrol within a horizontally scrolling uiscrollview. The scrollview is working just
I have a UISegmentedControl which I'd like to use to perform a certain action
I have the following UISegmentedControl, which I want to be disabled: -(void)displayCheckMark { titleSegmentedControl
I have a UISegmentedControl that has 6 segments which I created in Interface Builder.
I have a view that has a UISegmentedControl in its bottom UIToolBar with 2
My application have UI similar to Phone.app->Recents: sectioned UITableView and a UISegmentedControl in the
I have a main navigationController controlled on the app's delegate and this navigationController contains

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.