0
0
iOS Swiftmobile~5 mins

Camera and photo library in iOS Swift - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of UIImagePickerController in iOS development?
UIImagePickerController is a built-in class that lets users pick images or videos from their photo library or take new photos or videos using the camera.
Click to reveal answer
beginner
Which privacy key must be added to Info.plist to access the camera?
You must add the key NSCameraUsageDescription with a message explaining why your app needs camera access.
Click to reveal answer
beginner
How do you check if the camera is available on an iOS device?
Use UIImagePickerController.isSourceTypeAvailable(.camera) to check if the device has a camera before trying to use it.
Click to reveal answer
intermediate
What delegate protocol must your class conform to when using UIImagePickerController?
Your class must conform to <strong>UIImagePickerControllerDelegate</strong> and <strong>UINavigationControllerDelegate</strong> to handle image picking results and navigation events.
Click to reveal answer
beginner
Why is it important to dismiss UIImagePickerController after picking an image?
Dismissing UIImagePickerController returns control to your app's interface and prevents the picker from blocking user interaction.
Click to reveal answer
Which source type allows users to select photos from their library?
A.camera
B.photoLibrary
C.savedPhotosAlbum
D.video
What must you do before accessing the camera in your app?
AEnable background modes
BRequest microphone permission
CAdd NSCameraUsageDescription in Info.plist
DNothing special is needed
Which delegate method handles the event when a user finishes picking an image?
AimagePickerController(_:didFinishPickingMediaWithInfo:)
BimagePickerControllerDidCancel(_:)
CviewDidLoad()
DapplicationDidBecomeActive()
How do you check if the device supports taking photos?
AUIImagePickerController.isSourceTypeAvailable(.camera)
BUIDevice.current.hasCamera
CAVCaptureDevice.isAvailable()
DNo check is needed
What happens if you don't dismiss UIImagePickerController after use?
AThe app automatically dismisses it
BThe app crashes
CNothing happens
DThe picker stays on screen and blocks interaction
Explain the steps to let a user take a photo and use it in your app.
Think about permissions, presenting the camera, and handling the result.
You got /5 concepts.
    Describe how to allow users to pick an existing photo from their library.
    Focus on the photo library source and delegate handling.
    You got /4 concepts.