Skip to content

Commit 556a8e2

Browse files
Kirill IvoninKirill Ivonin
authored andcommitted
fixed issue 1and2papa#146 and controller containment
"negative or zero item sizes are not supported in the flow layout" in simulator"
1 parent 4725e53 commit 556a8e2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

CTAssetsPickerController/CTAssetsPickerController.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,28 +258,26 @@ - (void)setupSplitViewController
258258
svc.presentsWithGesture = NO;
259259
svc.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;
260260

261-
[svc willMoveToParentViewController:self];
262-
[svc setViewControllers:@[master, detail]];
261+
[self addChildViewController:svc];
263262
[svc.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
264263
[self.view addSubview:svc.view];
265-
[self addChildViewController:svc];
266264
[svc didMoveToParentViewController:self];
267265

268266
[vc reloadUserInterface];
269267
}
270268

271269
- (void)setupChildViewController:(UIViewController *)vc
272270
{
273-
[vc willMoveToParentViewController:self];
271+
[self addChildViewController:vc];
274272
[vc.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
275273
[self.view addSubview:vc.view];
276-
[self addChildViewController:vc];
277274
[vc didMoveToParentViewController:self];
278275
}
279276

280277
- (void)removeChildViewController
281278
{
282279
UIViewController *vc = self.childViewControllers.firstObject;
280+
[vc willMoveToParentViewController:nil];
283281
[vc.view removeFromSuperview];
284282
[vc removeFromParentViewController];
285283
}

0 commit comments

Comments
 (0)