Whether you have the original iPhone or the new iPhone 3G, you are in luck because there’s a hack to allow focusing of the camera simply by removing some glue after you hack it open.
This glue was applied at the two indented points on opposite sides of the camera as indicated, but is rather rubbery. I found that slicing lightly along the division and then scraping with the backside of the blade, I could remove almost all visible glue (it may leave light marks, but as long as some “crumbs” of the rubber glue come out, you should be fine. Now, you may be able to rotate the inner assembly by hand if none seeped in further, but if it still won’t budge, try grasping the raised area with protruding “grip” sections with the pliers and rotate clockwise gently. It should break free, and now be turnable by finger. Rotating counterclockwise makes closer objects in focus, while rotating clockwise goes back out.
On both the first-gen and 3G, you can use the camera app to give a live preview.