Rotation is not animated for viewing after tabViewController setSelectedIndex

Rotation is activated for the status bar (which has a clock and a battery icon), but the view itself simply changes its size; it does not perform page flipping animation. In the gif (below), I made several screencaptures of the rotation animation in slow motion. You can see how the clock and battery icon rotate in the view, although the content simply scales.

http://imgur.com/gallery/Q3OXCIH

I found several similar, but not exactly the same messages: Rotate an iOS Instant Snap device, not an animation

iOS 9 Orientation Automatic rotation animation does not work, but always on the main topic

This is somewhat repeatable - at first the rotation happens correctly, but after I programmatically changed the index of the table controller, it can start. After its launch, the rotation animation does not appear for presentation until I reset the application.

The code where I change the tab view controller and then change it:

[appDelegate.tabBarController setSelectedIndex:0];
...code to operate on the code at index 0...
[appDelegate.tabBarController setSelectedIndex:2];

To emphasize - it correctly animates the rotation the first time the application is launched. It behaves the same in the simulator and in the equipment. IOS 9. Xcode 7.1.1.

Does anyone know why the contents of the viewcontroller will stop animating during rotation?

edit-


To answer fragility questions:

1) , https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/#//apple_ref/occ/clm/UIViewController/attemptRotationToDeviceOrientation

shouldAutorotateToInterfaceOrientation shouldAutorotate supportedInterfaceOrientations. InterfaceOrientations , . shouldAutorotateToInterfaceOrientation shouldAutorotate, -, .

2) viewWillTransitionToSize - ios9, . willTransitionToTraitCollection, -, , . .

3) viewWillLayoutSubviews() viewDidLayoutSubviews(). viewDidLoad viewWillAppear. .

4) .

, , , , ( , ), , tabBarViewController selectedViewController , "ok" alertview. , , .

:

  • , .
  • "ok" alertview
  • [tabBarViewController setSelectedIndex: 0]
  • viewcontroller 0.
  • [tabBarViewController setSelectedIndex: 2] ( )
+4
1

- , viewcontroller ?

  • .
  • .
  • .
  • //.

, .

, , , , .

  • , .

UIViewController

  1. , , , iOS 9.

    func willTransitionToTraitCollection (_ newCollection: UITraitCollection,       TransitionCoordinator: UIViewControllerTransitionCoordinator)

    func viewWillTransitionToSize (_ size: CGSize, TransitionCoordinator: UIViewControllerTransitionCoordinator)

, , -, . UIContentContainer. >

  1. - , viewWillLayoutSubviews() . viewWillLayoutSubviews() viewDidLayoutSubviews().

. , UIAlertView? , !

        dispatch_async(dispatch_get_main_queue(), ^{
        [appDelegate.tabBarController setSelectedIndex:0];
    }); 
+3

Source: https://habr.com/ru/post/1618343/


All Articles