May 11, 2011

iPad and Showing the camera in Objective-C

Posted in iPhone development tagged , , , , , at 5:57 pm by tetontech

So here is a hint for using the camera with the iPad.

The iPad allows the camera view to rotate as the orientation of the device changes.  Imagine this set of views.

window

———-> base view

—————> subview

————–> camera view

If you display the camera from the subviews’ view controller the camera views’ control bar and the orientation of the camera view itself will only be correct if  the device is in portrait-right-side-up orientation when the camera view is displayed.  In any other orientation the camera view will be displayed incorrectly and this orientation error remains as the device orientation changes.

If the set of views is like this the camera view will be displayed correctly regardless of the original orientation of the device.  It will remain correct as the orientation of the device changes.

window

———-> base view

—————> camera view

So here is a rule for showing the camera via the UIImagePickerControllerDelegate class.

“The view controller that displays the camera must be controlling a view whose superView is the main window if the controlled view auto rotates.”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: