簡體   English   中英

適用於iOS設備的文本放大鏡

[英]Text Magnifying glass for iOS device

嗨,我想知道是否有人知道如何在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];

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM