Permalink
Browse files

Front and Rear Camera Helpers

  • Loading branch information...
1 parent 3a4a1ca commit bce38618059ff8bd8ec614c33dcec9ca52d68f72 @chalkers chalkers committed May 8, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/kernel.rb
View
@@ -12,6 +12,18 @@ def ipad?
UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad
end
+ # Verifies that the device running has a front facing camera.
+ # @return [TrueClass, FalseClass] true will be returned if the device has a front facing camera, false otherwise.
+ def front_camera?
+ UIImagePickerController.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceFront)
+ end
+
+ # Verifies that the device running has a rear facing camera.
+ # @return [TrueClass, FalseClass] true will be returned if the device has a rear facing camera, false otherwise.
+ def rear_camera?
+ UIImagePickerController.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceRear)
+ end
+
# Returns the application's document directory path where users might be able to upload content.
# @return [String] the path to the document directory
def documents_path

0 comments on commit bce3861

Please sign in to comment.