objective c - Camera view(UIImagePickerController) show different orientation for different ios devices -
i working in cocos2d-iphone
, try make augmented reality game. firstly followed this tutorial face problem.
my sample code is:
#product.h @interface product : ccnode <uiimagepickercontrollerdelegate,uinavigationcontrollerdelegate> { uiview *overlay; uiimagepickercontroller *cameraui; } +(ccscene *) scene; -(void)loadcameraview; @end
then
product.m
#define camera_transform 1.24299 -(void)loadcameraview { // prepare overlay view , add window overlay = [[uiview alloc] initwithframe:[[uiscreen mainscreen] bounds]]; overlay.opaque = no; overlay.backgroundcolor=[uicolor clearcolor]; cameraui = [[uiimagepickercontroller alloc] init]; cameraui.sourcetype = uiimagepickercontrollersourcetypecamera; cameraui.showscameracontrols = no; cameraui.toolbarhidden = yes; cameraui.navigationbarhidden = yes; cameraui.wantsfullscreenlayout = yes; //cameraui.shouldautorotate = no; cameraui.cameraviewtransform = cgaffinetransformscale(cameraui.cameraviewtransform, camera_transform, camera_transform); [overlay addsubview:[cameraui view]]; //[[ccdirector shareddirector].view addsubview:overlay]; [appdelegate.window addsubview:overlay]; [ccdirector shareddirector].view.backgroundcolor = [uicolor clearcolor]; [ccdirector shareddirector].view.opaque = no; //[appdelegate.navcontroller.view setuserinteractionenabled:false]; [appdelegate.window bringsubviewtofront:appdelegate.navcontroller.view]; }
this code works fine , load camera. in various device like: iphone, ipad, ipod
, in different ios version like: 7.0+, 8.0+, 9.0+
, camera view don't show same view in devices, images rotate -/+90 degree or more in same orientation of devices.
so, can issue can same view?
thanks
Comments
Post a Comment