I am writing a universal app using both UISplitViewController and a UISegmentedControl. Each controller in the UISegmentedControl allows editing. It appears that the editing state of the controllers must be re-established when a segment becomes the current segment. My problem is strange animations that result from [vc setEditing:YES animation:NO]. Can someone suggest how I might avoid this? Thank you.
- (void)segmentChanged:(UISegmentedControl *)sender
{
UIViewController *vc = [self viewControllerForSegmentIndex:sender.selectedSegmentIndex];
[self addChildViewController:vc];
[self transitionFromViewController:self.currentViewController toViewController:vc duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
[self.currentViewController.view removeFromSuperview];
vc.view.frame = self.view.bounds;
[self.view addSubview:vc.view];
[vc setEditing:YES animated:NO];
} completion:^(BOOL finished) {
[vc didMoveToParentViewController:self];
[self.currentViewController removeFromParentViewController];
self.currentViewController = vc;
}];
To avoid inappropriate animations, I completed the preparation preparation for display of the Controller with setEditing and viewWillAppear.