English 中文(简体)
年龄变化
原标题:UIImageView Transform Scale

我有一个UIButton,在压力下,UIImage电算比额表将稍有增加,然后回到正常规模。 它起作用,但我陷入了一个问题,即形象最终使你在纽顿的报章略微缩小。

我怎么能够改变法典,以便像你在纽顿时那样,形象不会减弱? 这里,我必须把图像稍微大,然后恢复正常:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 0.2];
myImage.transform = CGAffineTransformScale(myImage.transform, 1.03, 1.03);
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 0.2];             
myImage.transform = CGAffineTransformScale(myImage.transform, 0.97, 0.97);
[UIView setAnimationDelegate:self];
[UIView commitAnimations];

感谢任何帮助。

最佳回答

数学。 <代码>1.03* ∗ 0.97的缩略系数为0.9991,而不是1.0>。 无论是使用<代码>1.0/1.03作为您的第二大系数,还是仅仅将myImage.transform/code>用于身份改变(假设你不应用其他转变观点)。

问题回答

你们是否试图拯救第一次变革?

然后,不要使用<条码>CGAffine TransformScale,以缩小你的<条码>UIImageView,你只是使用你所挽救的变革吗?

        CGAffineTransform firstTransform = myImage.transform;

        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration: 0.2];
        myImage.transform = CGAffineTransformScale(myImage.transform, 1.03, 1.03);
        [UIView setAnimationDelegate:self];
        [UIView commitAnimations];
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration: 0.2];
        myImage.transform = firstTransform;
        [UIView setAnimationDelegate:self];
        [UIView commitAnimations];

你们在浮动点算术和累积矩阵业务中受到限制。 您将永远无法代表3/100,仅将其与以下数值相近:0.030.033/code>和0.0333<>。

对于您的问题,最好把第二次改为<条码>。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...