iphone how to determine and code according to base sdk version?

Posted by Nareshkumar on Stack Overflow See other posts from Stack Overflow or by Nareshkumar
Published on 2010-06-18T13:24:44Z Indexed on 2010/06/18 13:53 UTC
Read the original article Hit count: 248

I have a code for UIImage picker

 photoImagePicker=[[UIImagePickerController alloc]init];
photoImagePicker.delegate=self;
photoImagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
photoImagePicker.mediaTypes=[UIImagePickerController availableMediaTypesForSourceType:photoImagePicker.sourceType];
[self presentModalViewController:photoImagePicker animated:YES];

photoImagePicker.showsCameraControls = YES; //Doesnot work on 3.0
photoImagePicker.navigationBarHidden = YES;
photoImagePicker.toolbarHidden = YES;
photoImagePicker.allowsEditing=YES; //Doesnt work on 3.0

Now everything works fine when the sdk is 3.1 or higher but when i put the os version as 3.0, the code starts showing errors. Turns out these methods were not present in 3.0 and so errors. I want to keep a mechanism which will enable these for higher versions(3.1) and at the same time work properly for 3.0 version. How do i do it?

One solution i have thought of is to verify the version value and then put that code. But i am not sure how this is got. Any help will be appreciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiimagepickercontroller