Subview cannot be displayed in the camera preview in IOS with swift -


i use avfoundation framework capture , display camera video preview , works. now, want add own uiimageview on top of camera preview, here fragments of code.

            previewlayer = avcapturevideopreviewlayer(session: capturesession)             previewlayer!.videogravity = avlayervideogravityresizeaspect             previewlayer!.connection?.videoorientation = avcapturevideoorientation.portrait             previewlayer!.frame = previewview.bounds             previewview.layer.addsublayer(previewlayer!)              var imageview : uiimageview             imageview = uiimageview(frame: cgrect(x: 130,y: 320,width: 60,height: 30))             imageview.image  = uiimage(named:"scanbutton.png")                             previewview.addsubview(imageview)              self.capturesession!.startrunning() 

the "scanbutton.png" image file in project folder.

the uiimageview cannot displayed. can tell what's wrong, thanks.


Comments

Popular posts from this blog

libGdx unable to find files in android application data directory -

php - Webix Data Loading from Laravel Link -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -