[Solved] Auto Rotation Issue

I am building a game which supports both Portrait and Landscape orientation,
while I am implementing the autorotation handling,
I found that it behaves a bit strange when rotating from Portrait to Landscape,
which the view is shifted left and it is not rotating with the center of the view.
This issue exists in 2.1, 2.2 and 3.0

Is there any fix to make the view rotating with its center?
Thanks for your help!

How are you handling orientation changes?

Finally, I managed to fix the orientation, I found that I have to use

rather than

to handle Orientation Change.

Final setup:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return UIInterfaceOrientationIsPortrait( interfaceOrientation )|| UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
    return UIInterfaceOrientationMaskAll;//AllButUpsideDown;
#endif
}

- (BOOL) shouldAutorotate {
return YES;
}

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    // Detect Orientation
    CGSize s;
    bool isLandscape = false;
    if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation))
    {
        s = CGSizeMake(std::max(UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height),
                       std::min(UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height));
        isLandscape = true;
    }
    else
    {
        s = CGSizeMake(std::min(UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height),
                       std::max(UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height));
        isLandscape = false;
    }

    CCDirector* director = cocos2d::CCDirector::sharedDirector();
    CCSize contentSize = CCSizeMake(s.width * UIScreen.mainScreen.scale, s.height * UIScreen.mainScreen.scale);

    director->getOpenGLView()->setFrameSize(contentSize.width, contentSize.height);
    director->getOpenGLView()->setDesignResolutionSize(contentSize.width, contentSize.height, kResolutionExactFit);

    // Get current running scene
    // Call Specific method on the scene to position UI
}