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

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -