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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:45:30+00:00 2026-06-04T13:45:30+00:00

I started objective C today and for the last hour I’ve been trying to

  • 0

I started objective C today and for the last hour I’ve been trying to work out how to switch an image when I click a button, It’s a segmenting button with 2 segments, first segment should load 0.jpg, second segment should load 1.jpg.

I can get it to change from 0->1 but not back, so it’s as if only the first switch is being registered, any ideas?

(As you can see, i’ve tried debugging, everything should check out:

2012-05-25 13:22:31.173 Clock2[3398:f803] Segment clicked: 0
2012-05-25 13:22:31.174 Clock2[3398:f803] 0.jpg
2012-05-25 13:22:31.367 Clock2[3398:f803] Segment clicked: 1
2012-05-25 13:22:31.368 Clock2[3398:f803] 1.jpg

.

- (IBAction)clockselect:(id)sender {
    NSString* segindex= [NSString stringWithFormat:@"%d", clockselectout.selectedSegmentIndex];
    NSString* type= @".jpg";
    NSString* filename= [segindex stringByAppendingString:type ];
    if (clockselectout.selectedSegmentIndex == '0') {
       NSLog(@"Segment clicked: %d", clockselectout.selectedSegmentIndex);
       // NSLog(filename);
        [clockimg setImage:[UIImage imageNamed: filename]]; 
    } else {
       NSLog(@"Segment clicked: %d", clockselectout.selectedSegmentIndex);
       // NSLog(filename);
        [clockimg setImage:[UIImage imageNamed: filename]]; 
    }

}
  • 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-04T13:45:31+00:00Added an answer on June 4, 2026 at 1:45 pm
    -(IBAction)segmentControleChanged
     {
    
      switch(self.yourSegmet.selectedSegmentIndex)
        {
    
            case 0:
             [clockimg setImage:[UIImage imageNamed: @"image1"]];
             break;
    
              case 1:
              [clockimg setImage:[UIImage imageNamed:@"image2"]];
               break;
    
                default:
                 break;
           }
    
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been learning Objective-C and just recently started using classes (instead of having everything
A really basic question, I have recently started exploring Objective C and Trying to
I've been using objective C for a while now, and I've started learning some
I just started programming in objective-c(today) and I'm just doing some simple command line
Since I started learning Objective-C and Cocoa, I've been wondering why they have chosen
Possible Duplicate: How does a category work in Objective-C? I am just getting started
I have recently started to learn Objective-C and write my tests using OCUnit that
I've recently started down the road of programming in Objective-C, and I'm now looking
I started writing functional tests for my rails app today. I use the RESTful
I started using Core Data for iPhone development. I started out by creating a

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.