0

My segmented control in the xib view doesn't show up when I run the application. Please help me!

m File

- (IBAction) segmentedControlIndexChanged{
  switch (self.segmentedControl.selectedSegmentIndex) {
    case 0:
          self.carImage.image = [UIImage imageNamed:@"someimage.png"];
      break;
    case 1:
          self.carInfo.text = @"Segmented 1 selected.";
      break;
      case 3:
          self.carImage.image = [UIImage imageNamed:@"middleRow.png"];
          break;
    default:
       break;
   } 
}
@end

h File

IBOutlet UIImageView *carImage;
UISegmentedControl *segmentedControl;
IBOutlet UILabel *carInfo;
}

@property (nonatomic, retain) UIImageView *carImage;
@property (nonatomic, retain) UILabel *carInfo;
@property (nonatomic, retain) IBOutlet UISegmentedControl *segmentedControl;

- (IBAction) segmentedControlIndexChanged;

@end
Jovany
  • 1
  • 1
  • The code you showed doesn't help diagnose the problem. Are you sure you have the control added in your xib? I..don't even know what questions to ask here. Can you show a screenshot of the xib? – jtbandes Jun 28 '11 at 06:27
  • Have you set properly the referencing outlets in Xib? I suspect the problem is there. – Manoj Jun 28 '11 at 06:31
  • @jtbandes, yes I did added it..@manoj, and yeah its been properly referenced to... – Jovany Jun 28 '11 at 06:53
  • Are you able to view other labels? – Nitish Jun 28 '11 at 06:54

2 Answers2

0

Your segmented control should be showing up regardless of whether you actually have it connected correctly or not. Can you see it in your .xib from when you dragged it out? If you have other UI is it possibly hiding underneath another view. If you show the detail view of your document window you can see the view hierarchy. Aside from this post a screenshot of your .xib if you're still having trouble.

Jamie
  • 5,090
  • 28
  • 26
0

I don't know what version of Xcode you are using, but I often had a similar problem with Xcode 3.2 and the separate Interface Builder. It happened when I hadn't properly saved the .nib file in IB. In Xcode 4, that doesn't happen to me anymore.

Rudy Velthuis
  • 28,387
  • 5
  • 46
  • 94