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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

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