Reputation: 3
iPhone can be stood on the ground and then, when it vibrates, it spins on the ground so we can use this feature to take a panoramic picture. actually there is an app that functions the same I wrote above. The app is called "Cycloramic" It could be meaningless, but I want to build this app to study iOS programming.
Now I faced a problem, that it just vibrates, ignores a part of taking pictures.
this is the code.
when I pushed the button, it starts.
first, it takes a picture then vibrates until it rotates 29 angle. Then it takes one more picture. This is what it is meant to function.
But, when I start the app, it only vibrates and never takes a picture at all.
what is wrong with it?
if([self.rangeSelectionButton.title isEqualToString:@"90"])
{
range = 90;
}
else if ([self.rangeSelectionButton.title isEqualToString:@"180"])
{
range = 180;
}
else if ([self.rangeSelectionButton.title isEqualToString:@"270"])
{
range = 270;
}
else if ([self.rangeSelectionButton.title isEqualToString:@"360"])
{
range = 360;
}
else
{
return;
}
switch (range)
{
case 90:
[self.imagePickerController takePicture];
[self.motionSensor updateGyro];
self.beforeRoll = self.motionSensor.roll;
for(;(self.motionSensor.roll - self.beforeRoll) <= 29;){
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
[self.motionSensor updateGyro];
}
[self.imagePickerController takePicture];
[self.cameraTimer fire];
break;
case 180:
break;
case 270:
break;
case 360:
break;
default:
break;
}
I posted entire code above. The if statements check the angle I want to take a pictures.
The switch statements functions, according to angle. I was writing only 90 angle part. Thanks.
Upvotes: 0
Views: 542
Reputation: 12678
From the docs for takePicture
:
Calling this method while an image is being captured has no effect. You must wait until the associated delegate object receives an
imagePickerController:didFinishPickingMediaWithInfo:
message before you can capture another picture.
Are you making sure that the original image has been captured?
I don't think that UIImagePickerController
is the right library to use for what you are trying to do.. It would probably be a better idea to use AVFoundation to get the pictures you want.
Apple have also provided the sample project AVCam to show how you can achieve this.
Upvotes: 1