2013-04-19 2 views
1

iCarousel 화면 방향 변경 중에 회전식보기에 배치 된 항목의 크기를 조정하는 데 문제가 있습니다. 어떻게 수정합니까?ios에서 화면 방향으로 회전하는 동안 회전식보기 크기 조정

여기 프레임은 그렇지가 영향을주지 것이다 동향 방법에 회전 목마를 다시로드해야 변경 잘 내 코드

- (void) handleOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 

    if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { 

     orient = YES; 

     _deptCarousel.center = CGPointMake(390, 628); 

    }else { 

     orient = NO; 

     _deptCarousel.center = CGPointMake(512, 455); 

    } 

} 

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index 
{ 

    //create a numbered view 
    UIView *viewBG = nil; 
    viewBG = [[UIImageView alloc]initWithImage:[UIImage imageNamed:[email protected]"Scroll_Placeholder_ImageiPad.png":@"Carousel_Placeholder_Image.png"]]; 
    if (IS_IPAD) { 
     if (orient) { 
      viewBG.frame = CGRectMake(0, 0, 420, 350); 
     }else{ 
      viewBG.frame = CGRectMake(0, 0, 380, 280); 
     } 
    } else { 
     viewBG.frame = CGRectMake(0, 0, 210, 170); 
    } 
} 

답변

2

는 내가 처음 time.You에 대한 iCarousel 부하를 확인하고 때마다 Carousel보기 당신의 방향 변경의 크기를 조정해야 할 때 당신이 당신의 장치 방향을 확인했다 생각합니다. 따라서 아래의 오리엔테이션 위젯에서 확인하십시오.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    UIInterfaceOrientation statusBarOrientation = [[UIApplication sharedApplication] statusBarOrientation]; 

    if (IS_IPAD) { 
     if (orient) { 
      viewBG.frame = CGRectMake(0, 0, 420, 350); 
     }else{ 
      viewBG.frame = CGRectMake(0, 0, 380, 280); 
     } 
    } 

    [_deptCarousel reloadData]; 

    return YES; 
} 

내가 도움이 될 것이라고 생각합니다. 이 질문에 대한 질문이 있으면 알려주십시오.

감사합니다.

+0

좋은, 고마워 !!! – dineshsurya

+0

그레이트 :) 해피 코딩 .... – NSUserDefault

2

입니다.

- (void) handleOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 

    if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { 

     orient = YES; 

     _deptCarousel.center = CGPointMake(390, 628); 

     //reload your Carousel 

    }else { 

     orient = NO; 

     _deptCarousel.center = CGPointMake(512, 455); 

     //reload your Carousel 


    } 

} 
+0

덕분에 ... – dineshsurya

관련 문제