IOS Swift what am I messing up on in my UIView adding a subview -


i have uiview , set constraints on image below shows . when open in simulator works correctly . problem comes when try , add wkwebview display video , add subview . want video take dimensions of uiview video looks small , uiview looks shrinks . how can fix video takes full dimensions of uiview . can see constraints set trail , leading , video not taking width though large enough . thing can think of fixing adding a

addchildviewcontroller(viewcontroller)

however wkwebview not have controller suggestions great .

class exampletable: uiviewcontroller, wkuidelegate {     @iboutlet weak var newview: uiview!     var mywkwebview: wkwebview?      override func viewdidload() {         super.viewdidload()          mywkwebview?.uidelegate = self         guard let movieurl = url(string: "my video url")             else { return }         let webconfiguration = wkwebviewconfiguration()         webconfiguration.allowsinlinemediaplayback = true         webconfiguration.mediatypesrequiringuseractionforplayback = .audio          mywkwebview = wkwebview(frame: newview.frame,configuration: webconfiguration)          newview.addsubview(mywkwebview!)            dispatchqueue.main.async (execute: { () -> void in             self.mywkwebview?.loadhtmlstring("<video  height=\"\(self.newview.frame.height)\" width=\"\(self.newview.frame.width)\" muted=\"muted\"  autoplay=\"autoplay\"   src=\"\(movieurl)\" playsinline/>", baseurl: nil)             })      }  } 

my constraints

enter image description here

how looks no addsubview

this how looks no add subview how looks when add subview display video

how looks add subview

can please check below code :

mywkwebview = wkwebview(frame: cgrect(origin: cgpoint(x:0,y:0), size: newview.frame.size),configuration: webconfiguration) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -