【问题标题】:Text Magnifying glass for iOS deviceiOS 设备的文本放大镜
【发布时间】:2012-01-16 11:09:32
【问题描述】:

您好想知道是否有人知道如何在 iPhone 上为文本制作放大镜效果。网上有很多 JavaScript 示例说明如何对图像执行此操作,甚至还有一些是为文本设计的,但是这些示例都不能在移动设备上使用触摸和拖动。

我对 HTML 和 JavaScript 有点陌生,因此我们将不胜感激。 (顺便说一下,我知道 iPhone 有一个内置的放大镜,但我需要它放大很多并且放大更远)

干杯

【问题讨论】:

  • 有一个内置的缩放功能,为什么只需要一个文本?
  • 见上文“(顺便说一句,我知道 iPhone 有一个内置的放大功能,但我需要它更大一些,放大更远)”

标签: javascript iphone touch zooming magnify


【解决方案1】:

你可以看看这个你的想法,这个演示实现了效果 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];

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-13
    • 2015-08-05
    • 2016-03-08
    • 1970-01-01
    • 1970-01-01
    • 2012-06-27
    相关资源
    最近更新 更多