2011-12-09 28 views
0

你想知道如果有人知道如何在iPhone上的文字放大鏡效果。網上有很多關於如何爲圖片做這些事情的JavaScript示例,甚至還有一些針對文本設計的示例,但是這些示例都不適用於移動設備上的觸摸和拖動。iOS設備的文字放大鏡

即時通訊一點點與HTML和JavaScript noobie所以任何幫助,將不勝感激。 (順便說一下我知道的iPhone已經內置在放大,但我需要它是大了很多,更遠縮放)

乾杯

+0

有一種內置變焦功能,爲什麼是一個需要只是爲了文字? – RobG

+0

見上文「(順便說一句,我知道iPhone有內置的放大功能,但我需要它變得更大,放大得更遠)」 – Roksalt

回答

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

}