ios - UIImagePickerController front camera show mirror image on preview view -


i know many people had asked question, not found correct answer fix issue,my problem : how can make photo on preview view(after user tap capture button,and go preview view let user preview) not mirror, can prossible fix in uiimagepickercontroller, know how rotate photo , in enum in uiimageorientation uiimageorientationup, know mean.

try 1:

i attend photo after user tap capture button before go preview view , use photo have mirror cover default photo (use cameraoverlayview), can detect user tap capture button use nsnotificationcenter @"_uiimagepickercontrolleruserdidcaptureitem", find no way photo.

try 2:

i use cameraviewtransform, when user take photo (front camera) when home button on bottom or top, image on preview view not mirror, when home button on left or right, image on phone have problem before user tap capture, although image on preview view not mirror.use avcapturedevicedidstartrunningnotification notification.

- (void)camerachanged:(nsnotification *)notification {   if(self.imagepickercontroller.cameradevice == uiimagepickercontrollercameradevicefront)   {      self.imagepickercontroller.cameraviewtransform = cgaffinetransformidentity;      self.imagepickercontroller.cameraviewtransform = cgaffinetransformscale(self.imagepickercontroller.cameraviewtransform, -1, 1);      if (self.imagepickercontroller.cameraoverlayview) {         nslog_debug(@"self.imagepickercontroller.cameraoverlayview not nil");     } else {         nslog_debug(@"self.imagepickercontroller.cameraoverlayview nil");     }     self.imagepickercontroller.cameraoverlayview.transform = cgaffinetransformscale(self.imagepickercontroller.cameraviewtransform, -1, 1);   } else {     self.imagepickercontroller.cameraviewtransform = cgaffinetransformidentity;   } } 

finally, can not solve issue in uiimagepickercontroller, solve issue using avfoundation , coremotion, can see avcam

//init motionmanager - (void)initializemotionmanager{   motionmanager = [[cmmotionmanager alloc] init];   motionmanager.accelerometerupdateinterval = .1;   motionmanager.gyroupdateinterval = .1;    [motionmanager startaccelerometerupdatestoqueue:[nsoperationqueue currentqueue]                                     withhandler:^(cmaccelerometerdata  *accelerometerdata, nserror *error) {                                         if (!error) {                                             [self outputaccelertiondata:accelerometerdata.acceleration];                                         }                                         else{                                             nslog_debug(@"%@", error);                                         }                                     }];   }  //detect device orientation - (void)outputaccelertiondata:(cmacceleration)acceleration{    if (acceleration.x >= 0.75) {       _orientationnew = uiinterfaceorientationlandscapeleft;   }   else if (acceleration.x <= -0.75) {       _orientationnew = uiinterfaceorientationlandscaperight;   }   else if (acceleration.y <= -0.75) {       _orientationnew = uiinterfaceorientationportrait;   }   else if (acceleration.y >= 0.75) {       _orientationnew = uiinterfaceorientationportraitupsidedown;   }   else {       // consider same last time       return;   }    if (_orientationnew == _orientationlast)       return;    _orientationlast = _orientationnew; } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -