Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does PreferredPrimaryColumnWidthFraction in UISplitViewController have a limit?

I am trying to make a split view controller with the master view larger than the default one.

So I have subclassed it:

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.preferredPrimaryColumnWidthFraction = .5;
}

The thing is that I can't divide 50/50 as its written on code... I only goes like 40% maybe...

No value less than 0.4 would work...

any ideas?

like image 626
Andre Cytryn Avatar asked Sep 29 '14 21:09

Andre Cytryn


2 Answers

Try setting self.maximumPrimaryColumnWidth to something large before setting the preferredPrimaryColumnWidthFraction property. This worked for me.

Per UISplitViewController Class Reference:

The actual width of the primary view controller is constrained by the values in the minimumPrimaryColumnWidth and maximumPrimaryColumnWidth properties. The split view controller makes every other attempt to honor the width you specify but may change this value to accommodate the available space.

like image 118
Jack M Avatar answered Oct 04 '22 10:10

Jack M


For 50/50 do:

splitViewController.maximumPrimaryColumnWidth = MAXFLOAT;
splitViewController.preferredPrimaryColumnWidthFraction = 0.5;

Setting these causes the view to load so do it in viewDidLoad rather than in applicationDidFinishLaunching.

like image 33
malhal Avatar answered Oct 04 '22 11:10

malhal