paul_1991
paul_1991

Reputation: 245

UISegmentedControl Problem setting hidden

Hi I regulary created using IB one UISegmentedControl that I called showAllSwitch. If I try to do [showAllSwitch setHidden:YES]; nothing happens! Why? How can I do to hide it?

Upvotes: 0

Views: 1383

Answers (2)

Dancreek
Dancreek

Reputation: 9544

Hiding an object is relatively straight forward. So if there is a problem then its something simple. You need to just go through some basic diagnostic steps:

  1. Verify that your segmented control is actually connected to the correct outlet in IB. Really. Go look. Even if you are sure. Go look again.
  2. Verify that the line where you are hiding it is being called. Add an NSLog just after and see if it shows up when it should.
  3. Make sure that the hide command is not getting sent too soon. If its being sent in ViewDidLoad try setting it up in ViewDidAppear.

Upvotes: 0

Matthew Knippen
Matthew Knippen

Reputation: 1058

Where are you calling setHidden? if it is being called before it is added to the view, then there could be problems. Try calling it in viewDidAppear and see it that works. If it doesn't either the segmentedControl is not connected correctly in IB, or there is a rather big problem that we are missing.

Upvotes: 1

Related Questions