라벨을 이동하고 크기를 조정하려하지만 라벨의 크기가 즉시 조정 된 다음 위치가 변경됩니다. 먼저 주석 처리 된 lbl.frame 줄을 간단히 시도했습니다. 다음으로이 질문에 발견iPad - 라벨 이동 및 크기 조정 방법
How to animate while resizing UIView
을 그리고 contentMode을 제외하고 다른 모든 코드를 추가. 이것은 내가 원했던 것이었지만 레이블의 글꼴이 축소되면서 아래쪽으로 조정되지 않았습니다. (나는 xib에 맞도록 조정한다). 마지막으로 contentMode 행을 추가하면 원래 프레임 선과 동일한 결과를 얻었습니다. 즉, 먼저 축소하여 처음으로 움직이게합니다.
lbl.contentMode = UIViewContentModeRedraw;
[UIView animateWithDuration:1.0 delay:0.0
options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
//lbl.frame = CGRectMake(x, mStartingLine.frame.origin.y+mStartingLine.frame.size.height, 100, 100);
CGRect theBounds = lbl.bounds;
CGPoint theCenter = lbl.center;
theBounds.size.height = 100;
theBounds.size.width = 100;
theCenter.y = mStartingLine.frame.origin.y+mStartingLine.frame.size.height+50;
theCenter.x = x;
lbl.bounds = theBounds;
lbl.center = theCenter;
}
completion:nil
];