2010-04-08 3 views
0

가로 및 세로로 표시하려는 TabBar 응용 프로그램이 있습니다. 문제는 내가 탭 2로 이동하여 테이블에서 선택하고 탭 1을 선택하고 장치를 회전 한 다음 탭 2를 다시 선택하면 콘텐츠가 장치가 회전하고 사용자 지정 방향 지정 콘텐츠를 올바르게 표시하지 않는다는 것을 알 수 없습니다. 내가보기에 어떤 방향으로 현재 알려주고있는 priovate 메서드를 작성하려고합니다. viewDidLoad에서는 세로로 가정하고 있지만 shouldAutoRotate에서는 콘텐츠의 올바른 정렬을 위해 개인 메서드를 찾고 있습니다. 도와주세요!! 난 당신이 각각의 뷰 컨트롤러에 -shouldAutorotateToInterfaceOrientation: 방법을 전달할 필요가 있다고 생각TabBar 응용 프로그램의 가로 및 세로보기 문제

#import "DetailViewController.h" 
#import "ScheduleTableViewController.h" 
#import "BrightcoveDemoAppDelegate.h" 
#import "Constants.h" 

@implementation DetailViewController 


@synthesize CurrentLevel, CurrentTitle, tableDataSource,logoName,showDescription,showDescriptionInfo,showTime, showTimeInfo, tableBG; 

- (void)layoutSubviews { 

showLogo.frame = CGRectMake(40, 20, 187, 101); 
showDescription.frame = CGRectMake(85, 140, 330, 65); 
showTime.frame = CGRectMake(130, 10, 149, 119); 
tableBG.frame = CGRectMake(0, 0, 480, 320); 

} 

/* 
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. 
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { 
     // Custom initialization 
    } 
    return self; 
} 
*/ 

/* 
// Implement loadView to create a view hierarchy programmatically, without using a nib. 
- (void)loadView { 
} 
*/ 


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
- (void)viewDidLoad { 
    [super viewDidLoad]; 
self.navigationItem.title = CurrentTitle; 
[showDescription setEditable:NO]; 
//show the description 
showDescription.text = showDescriptionInfo; 
showTime.text = showTimeInfo; 
NSString *Path = [[NSBundle mainBundle] bundlePath]; 
NSString *ImagePath = [Path stringByAppendingPathComponent:logoName]; 
UIImage *tempImg = [[UIImage alloc] initWithContentsOfFile:ImagePath]; 
[showLogo setImage:tempImg]; 
[tempImg release]; 
[self masterView]; 

} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
return YES; 
} 

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
isLandscape = UIInterfaceOrientationIsLandscape(toInterfaceOrientation); 
if(isLandscape = YES){ 
[self layoutSubviews]; 

} 

} 





- (void)didReceiveMemoryWarning { 
// Releases the view if it doesn't have a superview. 
    [super didReceiveMemoryWarning]; 

// Release any cached data, images, etc that aren't in use. 
} 

- (void)viewDidUnload { 
// Release any retained subviews of the main view. 
// e.g. self.myOutlet = nil; 
} 


- (void)dealloc { 
[logoName release]; 
[showLogo release]; 
[showDescription release]; 
[showDescriptionInfo release]; 
    [super dealloc]; 
} 


@end 

답변

0

: 여기 내 코드입니다. 다음과 같이 할 수 있습니다. UITabBarController :

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) 
      interfaceOrientation 
{ 
    for (UIViewController *viewController in [ self viewControllers ]) 
     [ viewController 
      shouldAutorotateToInterfaceOrientation:interfaceOrientation ]; 

    return YES; 
} 
관련 문제