i have a Universal iOS project that run perfectly with Xcode 5 (iOS 6 & iOS 7). I use different storyboard for iPad & iPhone.
When i run it with Xcode 6 GM, it works perfectly with iPhone but doesnt work with iPad. I debugged i found that there is problem with viewDidLayoutSubviews in UISplitViewController. For example:
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
NSLog(@"run");
// some config with frame of child controllers
}
It runs continuously and didnt stop.
Anyone has the same problem? Please help :(
Thank you!
The code you have inside the viewDidLayoutSubviews override for the child controllers is itself modifying the subviews of the view, and so is triggering viewDidLayoutSubviews to be called again, and again, and again.
To prevent this, try adding a BOOL property to your UISplitViewController to control the execution of the child controllers layout code.
@interface UISplitViewController()
...
@property (nonatomic) BOOL subViewLayoutCalled;
...
@end
Then in your viewDidLayoutSubviews...
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
NSLog(@"run");
if (!self.subViewLayoutCalled) {
self.subViewLayoutCalled = YES;
// some config with frame of child controllers
}
}
It's worth a go.
I had the same problem recently.
What I had seen it's every time you change the layout of your elements in your view it will call the following methods:
viewWillLayoutSubviews;
viewDidLayoutSubviews;
if you change something into the last, it will call it again;
I had the same problem - used it to resize the master/detail in UISplitViewCtrl.
To change the size master/detail try this new parameters in ios8, in for example viewDidLoad:
self.minimumPrimaryColumnWidth = 500;
self.maximumPrimaryColumnWidth = 500;
self.preferredPrimaryColumnWidthFraction = 1;
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