2014-03-25 21 views
0
-(void)viewWillAppear:(BOOL)animated 
{ 

view1=[[BIDViewController alloc]initWithNibName:@"BIDViewController" bundle:nil]; 
[self willAnimateRotationToInterfaceOrientation:view1.interFaceOrientaion1 duration:1]; 
} 

-(void)didReceiveMemoryWarning 
{ 
[super didReceiveMemoryWarning]; 
// Dispose of any resources that can be recreated. 
} 

    -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 

if (toInterfaceOrientation == UIInterfaceOrientationPortrait) 
{ 
    lable1.frame=CGRectMake(100 ,102 ,225 , 21); 
    [self setInterFaceOrientaion2:toInterfaceOrientation]; 
} 

if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) 
{ 
    lable1.frame=CGRectMake(250, 116,225 ,21); 
     [self setInterFaceOrientaion2:toInterfaceOrientation]; 
} 
else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight){ 
    lable1.frame=CGRectMake(250, 116, 225, 21); 
    [self setInterFaceOrientaion2:toInterfaceOrientation]; 
} 

}如何使應用程序,支持定向

@end

BIDViewController類可以能夠訪問屬性interFaceOrientation2, 但BIDViewController2類可以不能夠訪問屬性interFaceOrientation 認爲@類BIDViewController存在。

如何訪問此。

回答

0

而不是調用性質的改變,因爲每如下如下 入住定向viewWillApear方法

UIInterfaceOrientation orientation=[[UIApplication sharedApplication] statusBarOrientation]; 
[self willAnimateRotationToInterfaceOrientation:orientation duration:1]; 
相關問題