2013-03-28 1 views
1

내 ios6 응용 프로그램의 supportedInterface 방향 메서드에서 2 번 호출합니다. 이 문제를 방지하고 ios6에서 한 번만 호출하도록하는 방법. 이 문제를 해결할 수있는 방법을 알려 주시기 바랍니다. 미리 감사드립니다.supportedInterfaceOrientations가 ios6에서 여러 번 호출하는 이유

-(BOOL)shouldAutorotate 
{ 
    return YES; 
} 




- (NSUInteger)supportedInterfaceOrientations 
{ 
    [email protected]"thumbnailNotSelected"; 
    NSLog(@"appdelegate.previewImageScallingmethodCallControlValue value is %d",appdelegate.previewImageScallingmethodCallControlValue); //Gestures settings 
    viewsHiddingGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(operationsOnViews:)]; 
    viewsHiddingGesture.cancelsTouchesInView=NO; 
    [self.view addGestureRecognizer:viewsHiddingGesture]; 


    launchPopOverGesture=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(annotationsPopOver:)]; 
    launchPopOverGesture.minimumPressDuration=0.8; 
    launchPopOverGesture.allowableMovement=NO; 
    launchPopOverGesture.cancelsTouchesInView=NO; 
    [tiledView addGestureRecognizer:launchPopOverGesture]; 
    addAnnotationsGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(addPinAnnotation:)]; 
    annotationScroller.contentSize=CGSizeMake(258, 700); 

    appdelegate =(AppDelegate *)[[UIApplication sharedApplication]delegate]; 

    UIInterfaceOrientation statusBarOrientation =[UIApplication sharedApplication].statusBarOrientation; 


    NSLog(@"statusBarOrientation in supported interface orientations is %d",statusBarOrientation); 

    NSLog(@"PREVIEWIMAGESCALLING VALUE IS %d",appdelegate.previewImageScallingmethodCallControlValue); 



    if(statusBarOrientation == UIInterfaceOrientationLandscapeLeft || statusBarOrientation == UIInterfaceOrientationLandscapeRight) 
    { 
     // code for landscape orientation 
     patternRemovalValue=0; 

     [self landscapeOrientation]; 


     if(appdelegate.previewImageScallingmethodCallControlValue==1) 
     { 
      [self previewImageScallingInLandscape]; 
      firstOrientationChange=YES; 
      appdelegate.getImagesResponseArrayObjectNumber=0; 

     } 

     else if(((appdelegate.previewImageScallingmethodCallControlValue%2)==0) && (appdelegate.previewImageScallingmethodCallControlValue > 1)) 
     { 
      [self previewImageScallingInLandscape]; 
      firstOrientationChange=NO; 


     } 

     appdelegate.orientationChangesCount++; 
     patternRemovalValue++; 
     appdelegate.previewImageScallingmethodCallControlValue++; 


    } 
    else if(statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown || statusBarOrientation == UIInterfaceOrientationPortrait) 

    { 
     // code for Portrait orientation 
     patternRemovalValue=0; 

     [self potraitOrientation]; 


     if(appdelegate.previewImageScallingmethodCallControlValue==1) 
     { 
      [self previewImageScallingInPotrait]; 
      firstOrientationChange=YES; 
      appdelegate.getImagesResponseArrayObjectNumber=0; 


     } 

     else if(((appdelegate.previewImageScallingmethodCallControlValue%2)==0) && (appdelegate.previewImageScallingmethodCallControlValue > 1)) 
     { 
      [self previewImageScallingInPotrait]; 
      firstOrientationChange=NO; 

     } 


     patternRemovalValue++; 
     appdelegate.previewImageScallingmethodCallControlValue++; 


    } 

return UIInterfaceOrientationMaskAll; 
} 
+0

네,하지만 확실 해요 어떻게 내가 게시 할 수 있습니다 알려주세요. 나는 stackoverflow에 새로운 오전 그래서 내가 그 절차를 모른다. – Naresh

+0

답장을 보내 주셔서 감사합니다. 하지만 여기에 한계가 있습니다. 좋아요. 코드로 한 가지 더 질문을 드리겠습니다. 답장을 보내주십시오. 그것은 너무 급한 arun 제발 나를 도와주세요. – Naresh

+0

그냥 답을 수정하고 코드와 게시물을 추가하십시오. – Spynet

답변

0

이런 일이 발생하는 이유는 모르겠지만, 내 경험에 당신이 supportedInterfaceOrientations 여러 번 호출 될 것이라고 가정하고, 그와 로직 ​​거래를해야합니다. 대부분의 코드를 다른 곳으로 옮겨야합니다. 아마도 loadView 나 init 함수 일 것입니다. 표준 실습에서는 supportedInterfaceOrientations에 코드를 지정하여 지원하는 방향을 즉시보고합니다.