Search code examples
objective-cios8uisplitviewcontroller

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?


Solution

  • 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.