-2

I want to use the iPad3's rear camera as a magnifying glass as part of an app for elderly people.

My idea was to display the rear camera input with a fixed zoom (e.g. 3x). I haven't worked with iOS camera functionality yet - which UIView subclass do you recommend to use for this case and how can i display the camera's input (with a fixed zoom) without showing the camera buttons?

4

1 回答 1

2

I think you're going to get downvotes for the overly broad nature of your question; StackOverflow tends to be for solving very specific questions where the asker has tried something and can't make sense of the result.

That being said, probably the best place to start could be the AVFoundation, particularly the AVCaptureVideoPreviewLayer and the various bits of session you need successfully to create one. It's a layer rather than a view but trivial enough to wrap into a view, which wouldn't have any camera buttons unless you were specifically to start adding them. Transforms will work on it just like any other layer.

The AVFoundation was added in iOS 4. Prior to that the recommendation would have been to use a UIImagePickerController with showsCameraControls set to NO. However that's extraordinarily inflexible, the exact cameraViewTransform you need to apply to properly frame the input is not really documented and in my experience Apple seem to manage to break something about it almost every major OS release and most minor releases. The AVFoundation is specifically meant to fix those problems.

So what you should probably do now is read up on AVCaptureVideoPreviewLayer, try to get a sample project working and post here again if you get stuck on suitably self-contained code fragments.

于 2013-03-29T23:58:19.347 回答