私は誰かが助けてくれることを願っている奇妙なものを持っています。横向きに回転するとNavigationBarを非表示にするアプリがあります...
-(void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if( toInterfaceOrientation == UIInterfaceOrientationPortrait )
{
self.view = portraitView;
}
else if( toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft )
{
self.view = landscapeRightView;
[self.navigationController setNavigationBarHidden:YES animated:NO];
}
これは正常に機能し、NavBar は消えます。問題は、回転して縦向きに戻すと、NavBar が再表示されますが、ビューの中央で垂直になり、画面の上部で水平になりません!!! NavBar の再表示をどこに配置しても (回転後、前半後)、縦向きビューに戻ると、常に向きと場所が間違っています。
縦向きに戻す回転に関する私のコードは次のとおりです。
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if( self.view == portraitView )
{
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
}
誰でもアイデアを提供できますか?これは私を夢中にさせています!