ios - AVCaptureVideoPreviewLayer wrong frame capture -
i have code:
previewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:session]; [previewlayer setbackgroundcolor:[[uicolor blackcolor] cgcolor]]; previewlayer.videogravity = avlayervideogravityresizeaspectfill; calayer *rootlayer = [self.previewview layer]; [rootlayer setmaskstobounds:no]; [previewlayer setframe:cgrectmake([rootlayer bounds].origin.x, [rootlayer bounds].origin.y-20, [rootlayer bounds].size.width, [rootlayer bounds].size.height+40)]; [rootlayer addsublayer:previewlayer]; [previewlayer setbounds:previewlayer.frame]; [session startrunning];
when start capture image, splash white view shifts top on 20px (status bar height). , snaped picture has wrong frame (-20 top , 20 down or on top right , -20px down). actual previewimage frame is
cgrectmake(15, 59, 290, 200).
now capturing image (white splash view) in frame cgrect = (15, 59, 290, 170). snaped image has frame cgrect = (15, 59, 290, 230). i'm doing wrong? please help..
Comments
Post a Comment