cocos2d-x 2.0 How iOS device can rotate automatically between portrait and portraitUpsideDown?

I am using cocos2d-x 2.0. And I have set my device to portrait by

UIInterfaceOrientationIsPortrait( interfaceOrientation )

But I found my App can only support portrait orientation and doesn’t rotate when the orientation is changed to portraitUpsideDown (i.e., home button is on the top). Are there any ways to resolve this problem?

Firstly, check your setting in xcode: TARGETS > YourGame> Summary > iPhone / iPod Deployment Info> Supported Interface Orientations -> select both “Portrait” and “Upside Down”;
Secondly, review YourGame/ios/RootViewController.mm line 56 ~ line 70 if it’s correctly meat your requirement. You need to repare different code here for both iphone6.0 and 6.0 below.