-2

if you look at this solution, it presents the following if statement:

if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])

because I am new to Objective C, im not sure how this works. here is what i know: "UIImagePickerControllerSourceTypePhotoLibrary" is a value in an enum, isSourceTypeAvailable is a class method. Unfortunately I dont understand any more... can you provide an explanation on how this works ?

Community
  • 1
  • 1
fred sgard
  • 107
  • 1
  • 5

1 Answers1

0

UIImagePickerController is deal with image resource of iOS device.
There are two way by which iOS app can get image from device's resources.
1. Photo Library
2. Camera

UIImagePickerController has isSourceTypeAvailable which is a class method and it takes UIImagePickerControllerSourceType

And that method will return that Photo library or camera is available or not as a BOOL value.

So that we can perform tasks if resources are available.

Samir
  • 902
  • 9
  • 23
  • why doesnt isSourceTypeAvailable have any implimentation ? I mean, I dont see any code within this function – fred sgard May 27 '15 at 12:42
  • Well, b'cos its closed source. UIImagePickerContrller is class of UIKitFramework and its complied classes. This is not opensource. You won't see code of any frameworks in iOS SDK mostly. – Samir May 27 '15 at 12:45
  • thanks , now i understand, however there is some confusion about how this method works - is sourceType a parameter for this method ? – fred sgard May 27 '15 at 12:49
  • No, isSourceTypeAvailable: is name of method. UIImagePickerControllerSourceType is parameter – Samir May 27 '15 at 12:49
  • are you sure ?? isnt UIImagePickerControllerSourceType the name of the ENUM ? – fred sgard May 27 '15 at 12:52
  • Don't get confuse. You need to improve your basic for objective-c. UIImagePickerControllerSourceType is enum and Its parameter type in isSourceTypeAvailable: method. There are multile values for that enum – Samir May 27 '15 at 12:53