[英]Scaling down the width of a view after doing rotation by using CGAffineTransformScale
我已經將一個視圖(黑色矩形)直接繪制到x軸,然后我通過使用CGAffineTransformMakeRotation應用一些旋轉。請在旋轉后看到圖像1。
在此之后,我需要減小旋轉位置的寬度。 為此,我使用的是CGAffineTransformScale,但圖像沒有沿着斜坡縮小。請參見圖2。
如果我從綁定屬性更改寬度,那么它工作正常。 知道為什么CGAffineTransformScale表現得那樣。
以下是我的示例代碼。
**__block CGAffineTransform rotationTransform;
rotationTransform = CGAffineTransformMakeRotation(angle);
lineview.transform = rotationTransform;
[UIView animateWithDuration:10 animations:^{
CGAffineTransform finalTransform = CGAffineTransformScale(lineview.transform, 0.4, 1);
lineview.transform = finalTransform;
} completion:^(BOOL finished) {
}];
試試這個移動框架並改變寬度:)
VIEW.frame = CGRectMake(0,39, 320, 111);
這是格式
CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.