나는 내 자신의 레이아웃을 만들려고 노력합니다. 내 UIViewController
에 UITableView
을 사용했습니다. 서버에서 JSON 응답을 받았습니다. 이것은 상세한 발행물과 같습니다. 또한 내 출판물 이미지와 텍스트의 혼합을 포함하기 때문에 내 UITableViewCell
높이를 계산합니다. 나는 자신의 레이아웃을 썼고 회전 할 때 장치를 재 계산했다.정확하게 레이아웃하는 방법
for (UIView * sub in contentSubviews) {
if([sub isKindOfClass:[PaddingLabel class]])
{
PaddingLabel *textPart = (PaddingLabel *)sub;
reusableFrame = textPart.frame;
reusableFrame.origin.y = partHeight;
partHeight += textPart.frame.size.height;
[textPart setFrame:reusableFrame];
} else if([sub isKindOfClass:[UIImageView class]])
{
UIImageView * imagePart = (UIImageView *)sub;
reusableFrame = imagePart.frame;
reusableFrame.origin.y = partHeight;
reusableFrame.origin.x = screenWidth/2 - imageSize.width/2;
reusableFrame.size.width = imageSize.width;
reusableFrame.size.height = imageSize.height;
[imagePart setFrame:reusableFrame];
partHeight += imagePart.frame.size.height;
}
}
하지만 문제가 있습니다. 장치 변경 방향 상태 UIScrollView
오프셋이 동일 할 때. 나는 그것을 어떻게 바꿀 지 모른다. 회전하기 전에 :
회전 후 :
나는 RECT에 보이는 요소를 저장할. 제안 pls.