크기를 조정 한 후 내 뷰 UIViewController
을 어떻게 새로 고칠 수 있습니까? UITableViewController
에 reloadData
과 비슷한 방법이 필요합니다.ReloadData in UIViewController
다시로드하지 않고 UIViewController
의보기의 크기를 조정할 수 있습니까?
내 코드 :
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
orientation = toInterfaceOrientation;
if(orientation==3 || orientation==4)
{
heightBoxDimension1 = [GlobalData sharedGlobalData].heightLandscape;
widthBoxDimension1 = [GlobalData sharedGlobalData].widthLandscapeBig;
widthBoxDimension2 = [GlobalData sharedGlobalData].widthLandscapeSmall;
}
else
{
heightBoxDimension1 = [GlobalData sharedGlobalData].heightPortrait;
widthBoxDimension1 = [GlobalData sharedGlobalData].widthPortraitBig;
widthBoxDimension2 = [GlobalData sharedGlobalData].widthPortraitSmall;
}
for(UIView* view in self.view.subviews)
{
NSLog(@"%.0f %.0f %.0f %.0f ", view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height);
if(view.frame.size.width >400)
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, widthBoxDimension1, heightBoxDimension1)];
NSLog(@"%.0f %.0f %.0f %.0f ", view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height);
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, widthBoxDimension2, heightBoxDimension1)];
NSLog(@"%.0f %.0f %.0f %.0f ", view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height);
}
}
[self.view setNeedsDisplay];
}
내가보기 정적 치수 넣어 전역 변수의 종류가 나는 동일한 높이이지만 다른 폭보기 두 유형을 갖는다. 전원을 켤 때 시뮬레이터 ... 이러한 뷰를 다시로드하지는 뷰의 프레임이 메소드 그러나 변경 후
를 입력 콘솔의 출력은 다음과 같습니다
2012-06-05 10:53:09.309 TemplateiPad2[12561:207] 8 8 752 318
2012-06-05 10:53:09.309 TemplateiPad2[12561:207] 8 8 752 446
2012-06-05 10:53:09.309 TemplateiPad2[12561:207] 8 334 372 318
2012-06-05 10:53:09.309 TemplateiPad2[12561:207] 8 334 372 446
좋은 재 프레임하지만 돈을 수행 재 장전.
...이 SENTENSE DONT는 MY CASE에서 발견 – Davidin073