嗨,我想知道是否有人知道如何在iPhone上为文本制作放大镜效果。网上有很多关于如何对图像执行此操作的JavaScript示例,甚至有一些是针对文本设计的,但这些示例都不适用于移动设备上的触摸和拖动。
我是一个有超文本标记语言和JavaScript的新手,所以任何帮助都将不胜感激。(顺便说一句,我知道iPhone有一个内置的放大功能,但我需要它大得多,放大得更远)
干杯
发布于 2014-12-04 14:32:10
你可以查看你的想法,这个演示实现了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];}
https://stackoverflow.com/questions/8440738
复制相似问题