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?
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
andmaximumPrimaryColumnWidth
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.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With