USBFever 2x Optical Lens for iPhone 4 Review

by Goondaba in


I've been snapping some pictures on my iPhone 4 recently.  The iPhone 4 is a great casual camera, but I've been running into situations where I wish I had just a bit of zoom.  The iPhone doesn't have any optical zoom abilities.  What it does have is a ditigal zoom, which produces a very pixelated and ugly result.

After doing some searching, I recently picked up the 2x Optical Zoom lens from USBFever.  In my search, I'd found that there were lenses that offered up to 12x zoom (again, which you can get from USBFever).  But, besides being rather bulky, these lenses require a tripod.  Anyone who's tried taking a steady picture with a smartphone camera knows the difficulties of trying to hold the phone steady.  Stick a 12x zoom lens on that phone, and it's not humanly possible to hold the phone steady enough in your hand.  But my goal was to get something which I could easily snap on or off in casual use, and lugging around a giant lense and a tripod doesn't seem that casual to me.  At that point, you might as well carry around a real camera.

So, a week after ordering, the lens found itself to my door from Hong Kong ready to take for a spin.

The lens itself is screwed in place onto a specialized iPhone case which comes included in the package.  The idea is that you keep this case on your iPhone at all times, and then just screw in the lens whenever you need it.  I actually really like the case, so that won't be a problem.

 

General Use

After taking some shots, a few things became apparent.  First of all, it does indeed zoom.  But there's also a very noticeable distortion around the edges, accompanied by a vignette effect.  The distortions are more noticable in some shots than in others.

Comparisons

Without lens:

With lens:

 

Without lens:

 

With lens:

Conclusions

The distortions will have to be something I keep in mind when deciding whether to use the 2x lens, but I like having the option when I want to see something a bit more closely.


Method for Detecting Drag Events in the Canvas Element on Touch Devices

by Goondaba in


dragScreenshot.png

I was recently asked about being able to detect a drag event within a Canvas element on a mobile device. By default, if you try dragging on a web page with a canvas element, the entire page will shift and the touch input is lost.

This behavior can be overridden to allow capture of drag events. The basic strategy is to disable the touch events and capture them, and then respond to them manually.

Because the method to capture the touch input uses general Webkit directives, this solution will work on both iOS and Android devices.

You may view the example on your mobile device here

References:

"Touching and Gesturing on the iPhone"

"Canvas Tutorial"


UIActivityIndicatorView Without Threads

by Goondaba in


So I recently ran into a snag while trying to implement a UIActivityIndicatorView.  There's a great and simple explanation of how to do it on the Apple Developer forums.  This is how you're supposed to do it: you tell the UIActivityIndicatorView what method should be run in between starting animation and stopping animation.

My problem was that the code to be run in between starting and stopping animation wasn't in a method I could point the UIActivityIndicatorView to.  The purpose of the pinwheel animation was to let the user know that their iPhone hadn't died while trying to render Javascript.

You see, the app I was working on had some HTML tables that needed to have some work done on them before they were decent for public consumption.  So, that work was done with a Javascript and when the table was ready to be seen, the table would be made visible to the user.  But, until the table was ready to be seen, the user was just looking at a blank screen for a few seconds.

Anyway... I needed a way to start a UIActivityIndicatorView when a view was loaded and then be able to hide it, without the use of threads.  However, I couldn't find any good solutions.  So this is what ended up working for me:

 

 In the view you want to have the UIActivityIndicatorView to show up in, go to your interface (.h) file and define the UIActivityIndicatorView:

Now open up your NIB (.xib) file in Interface Builder.  Plop a UIActivityIndicatorView onto your view and place it where you want:

 Go ahead and make the connection to the UIActivityIndicatorView from the IBOutlet we just defined:

 Now, with the UIActivityIndicatorView selected, go to the Attributes Inspector.  There, make sure the "Hide When Stopped" and "Animating" checkboxes are checked:

Save your NIB and go to your view's implementation (.m) file.  What we've done so far is set up a UIActivityIndicatorView to show up as soon as your view loads and begin spinning, but now we need to stop it when we want.  So now just tell the UIActivityIndicatorView to stop animating when appropriate: