小编dar*_*han的帖子

使用一根手指触摸在中心旋转图像

我想用一根手指触摸在中心点上旋转下面的图像...

我想用触摸旋转图像时显示带有标签的图像值.

我已完成图像旋转,但问题是如何根据旋转设置图像的值.

旋转角度增加,因此我无法设置该值.

谁能帮我?

代码如下

float fromAngle = atan2(firstLoc.y-imageView.center.y, 
                            firstLoc.x-imageView.center.x);

    NSLog(@"From angle:%f",fromAngle);
    float toAngle = atan2( currentLoc.y-imageView.center.y, 
                          currentLoc.x-imageView.center.x);

    NSLog(@"to Angle:%f",toAngle);
    // So the angle to rotate to is relative to our current angle and the
    // angle through which our finger moved (to-from)
    float newAngle =angle+(toAngle-fromAngle);


    NSLog(@"new angle:%.2f",newAngle);


 CGAffineTransform cgaRotate = CGAffineTransformMakeRotation(newAngle);

 imageView.transform=cgaRotate;


angle = newAngle;
Run Code Online (Sandbox Code Playgroud)

谁能帮我 ?

iphone image rotation

11
推荐指数
1
解决办法
4909
查看次数

将Unicode字符转换为NSString

我收到了来自webservice的字符串,其中包含Unicode字符.我想将其转换为纯NSString.那我该怎么做?

例如:"这不是你的自行车"

那么如何删除unicode并用其相同的特殊符号替换它.

输出将是:"这不是你的自行车"

iphone utf-8 unicode-string

4
推荐指数
1
解决办法
2万
查看次数

每秒检测音频文件的振幅?

我想使用iPhone SDK每秒检测音频文件的幅度(以dB为单位)。根据每秒声音文件的dB大小,我需要此功能用于对象的嘴部动画。我怎样才能做到这一点 ?使用哪种音频框架是可能的?您是否有任何示例的链接?

iphone audio iphone-sdk-3.0 ios4 ios

2
推荐指数
1
解决办法
3120
查看次数

标签 统计

iphone ×3

audio ×1

image ×1

ios ×1

ios4 ×1

iphone-sdk-3.0 ×1

rotation ×1

unicode-string ×1

utf-8 ×1