0

iPhoneアプリで虫眼鏡タイプの効果を作成したいのですが、アニメーションでテキストがぼやけている状態からぼやけていない状態になります。誰かがそれを行う方法を考えることができますか?ありがとう。

4

2 に答える 2

2

iOS 6 では、CIFilter を使用して、画像を文字通りぼやけることができるようになりました。というわけで、どうしてもぼかしたい部分の画像を作り、それをCIFilterでぼかして、そのぼかした画像を重ねればいいわけです。次に、タイマーまたは CADisplayLink を使用して、アニメーションの連続する「フレーム」を要求し、同じことを行うたびに、ぼやけた画像を作成して表示するだけです。

于 2012-11-02T03:48:56.587 に答える
0

ルーペ効果です。

- (void)drawRect:(CGRect)rect {
    // here we're just doing some transforms on the view we're magnifying,
    // and rendering that view directly into this view,
    // rather than the previous method of copying an image.
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextTranslateCTM(context,1*(self.frame.size.width*0.5),1*(self.frame.size.height*0.5));
    CGContextScaleCTM(context, 1.5, 1.5);
    CGContextTranslateCTM(context,-1*(touchPoint.x),-1*(touchPoint.y));
    [self.viewToMagnify.layer renderInContext:context];
}

参考:http ://coffeeshopped.com/2010/03/a-simpler-magnifying-glass-loupe-view-for-the-iphone

于 2012-11-02T03:46:24.530 に答える