文本放大镜适用于iOS设备



嗨,想知道是否有人知道如何在iPhone上为文本制作放大镜效果。网上有很多关于如何在图像上实现这一点的JavaScript示例,甚至有一些是为文本设计的,但是这些都不能在移动设备上使用触摸和拖动。

我有点HTML和JavaScript的新手,所以任何帮助将不胜感激。(顺便说一下,我知道iPhone有内置放大镜,但我需要它更大,放大更远)

欢呼

你可以看看这个你的想法,这个演示实现的效果http://www.craftymind.com/creating-the-loupe-or-magnifying-glass-effect-on-the-iphone/

主代码是这样的

- (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];

}

最新更新