Pergunta

Alguém sabe de uma maneira de implementar a funcionalidade de zoom lupa de um UITextField no iPhone em uma visão UIImage?

Parte do aplicativo que estou construindo permite que um usuário para desenhar uma linha em um UIImage, um processo que pode envolver a precisão de posicionamento dos pontos. A fim de ajudar o usuário, eu quero dar a lupa zoom como visto ao posicionar o cursor em um UITextField. Alguém tem alguma idéia de como fazer isso? Os ponteiros a documentos relevantes?

Felicidades!

Foi útil?

Solução

This tutorial is well written and includes sample code:

http://www.craftymind.com/2009/02/10/creating-the-loupe-or-magnifying-glass-effect-on-the-iphone/

You need to comment out the line that imports CustomView.h and then it compiles and runs fine.

Outras dicas

I do not know of any relevant docs.

What I would do when implement something like this is. Show a UIImage representation of your view over the view. Then clip the overlay UIImage to just the portion of the view you want to enlarge. You can enlarge the portion by using CGAffineTransformScale.

You can draw a existing view to a UIImage by using CALayer's renderInContext: method.

    UIGraphicsBeginImageContext(self.view.frame.size);

    CGContextRef context = UIGraphicsGetCurrentContext();
    [self.view.layer renderInContext:context];

    UIImage *imageRepresentation = UIGraphicsGetImageFromCurrentImageContext();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top