0

I have 2 segues to 1 view. I want the segment control to be showed for a first segue and hide it and expand the table to the edge of view for a second segue. I tried to use setHidden: YES but that method doesn't allow me to use segment control's space for table.

I can't post images 'cause of low reputation but here is a link to screenshot.

  • You've set the Tableview frame according to the segues. setHidden Only Hides the view. So you've to increase the Table view height as `tableView.frame = CGRectMake(xx,xx,xx,xx + segmentCtrl Height);` – Balaji Ramakrishnan Aug 07 '15 at 05:13

1 Answers1

0

If you are using autolayout there is two options

Option 1: If you don't want to retain the segment control in the view after hiding it, add a constraint for table view bottom edge, set set its constant 0 and priority to high(or anything less that that of tableview and segment control). Now, remove the segment control from superview.(reference here)

Option 2: Add a constraint for tableview bottom bargain and set its constant to some height which gives enough space for segmented control. Then connect the layout constraint with an IBOutlet. when ever you want to hide the segmented control, hide it and set the constant of layout constraint to 0.

Community
  • 1
  • 1
Johnykutty
  • 12,091
  • 13
  • 59
  • 100