に呼び出されます:setBound幅と高さ
- (void)correctSize:(UIView*)view{
//check if the newWidth is rounded by 50
CGFloat correctWidth = roundf(_lastScale*_lastWidth/XPCollageGridHorizontalStepSize) * XPCollageGridHorizontalStepSize;
CGFloat correctHeight = roundf(_lastScale*_lastHeight/XPCollageGridVerticalStepSize) * XPCollageGridVerticalStepSize;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5f];
[view setBounds:CGRectMake(view.bounds.origin.x, view.bounds.origin.y, correctWidth, correctHeight)];
//[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, correctWidth, correctHeight)];
[UIView commitAnimations];
}
これは、写真のサイズを丸め。 66の幅は50,178〜200などに丸められます。 setFrameメソッドを使用するとうまくいきますが、私も回転を使って作業しているのでsetBoundsを使いたいと思います。
setBoundsを使用すると、ビューのサイズは変更されますが、300などの丸めた数値にリサイズする代わりに、311.23のようにランダムにサイズが変更されます。
ここに何か不足していますか?それが動作するかどう