Search code examples
iosobjective-cxcodestoryboarduisplitviewcontroller

UISplitViewController preferredPrimaryColumnWidthFraction not working on iPhone iOS 9


I've added a UISPlitViewController to the Main.storyboard and try to change the preferredPrimaryColumnWidthFraction = 0.5 property to make my master controller be the half screen instead of covering full screen, but it doesn't work at all. I've tried changing maximumPrimaryColumnWidth and minimumPrimaryColumnWidth but none of these seem to work. I wonder what am I missing for this to work.


Solution

  • I am currently working on an app with UISplitViewController and maximumPrimaryColumnWidth seems to work fine for me. Make sure you are setting the delegate for UISplitViewController like

    self.splitViewController.delegate = self;
    

    And then the primary column width as:

    self.splitViewController.maximumPrimaryColumnWidth = 320; // set the width based on screen needs.