2011-07-19 5 views
0

私は下のトップビューとテーブルビューにマップビューを持つプロジェクトで作業していますが、次のようにさまざまなビューの向きに調整できるようにしましたコード、ポートレートからランドスケープビューに変更するとテーブルビューが消えるxcode

- (BOOL)shouldAutorotateToInterfaceOrientation:  
(UIInterfaceOrientation)interfaceOrientation 
{ 


    return YES; 
} 

が、私は肖像画から風景にビューを変更するテーブルビューがdissappearedます表示、 はどのように私はこの作業を行うことができ、任意のヘルプは大

、よろしくお願いします

を理解されるであろう

答えて

0

テーブルビューは横長ビューで下に隠れていましたが、テーブルビューの位置と高さをハードコードして、縦長ビューと横長ビューの両方で同じ高さと位置に表示させる必要がありました

- (BOOL)shouldAutorotateToInterfaceOrientation:  (UIInterfaceOrientation)interfaceOrientation 
{ 
if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) { 
    CGRect tableViewFrame = [tableView frame]; 
    tableViewFrame.origin.x = 0; 
    tableViewFrame.origin.y = 500;   
    tableViewFrame.size.height=500; 
    [tableView setFrame:tableViewFrame]; 
} 
else if (UIInterfaceOrientationIsPortrait([UIDevice currentDevice].orientation)){ 
    CGRect tableViewFrame = [tableView frame]; 
    tableViewFrame.origin.x = 0; 
    tableViewFrame.origin.y = 755;   
    tableViewFrame.size.height=500; 
    [tableView setFrame:tableViewFrame]; 
} 

return YES; 
}