2011-11-21 3 views
0

나는 펄스 app, horizaontal tableview와 같은 앱을 가지고 있습니다. 섹션에 5 개의 행을 표시하고 싶지만 가로 또는 세로 방향 일 때 행의 너비를 제어하여 화면에 맞 춥니 다. 어떻게 할 수 있을까요?컨트롤 회전

답변

0

장치를 회전 할 때 UITableView 크기를 조정하십시오. 다음과 같은 내용 :

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration{ 
    //Resize your UITableView, i.e.: 
    orientation = self.interfaceOrientation; 
    if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) 
    { 
     myTable.frame = CGRectMake(x, y, width, height); 
    } 
    else 
    { 
     myTable.frame = CGRectMake(x, y, width, height); 
    } 

    [[self view] setNeedsDisplay]; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 
+0

감사합니다. – Alfonso