swift3 - Swift 3: how to get the width&height of imageview after loading view? -
i want width , height of image view after set image of imageview after view loading. used below source, failed them. got original width & height (50, 50). destination image loaded on imageview successfully.(size: 1050x890)
var photoname: string? override func viewdidload() { if let photoname = photoname { imageview.image = uiimage(named: photoname) } } fileprivate func updateminzoomscaleforsize(_ size: cgsize) { let width = imageview.frame.size.width let height = imageview.frame.size.height let widthscale = size.width / width let heightscale = size.height / height let minscale = min(widthscale, heightscale) scrollview.minimumzoomscale = minscale scrollview.zoomscale = minscale } override func viewdidlayoutsubviews() { super.viewdidlayoutsubviews() updateminzoomscaleforsize(view.bounds.size) }
where fault? please me! thank reading question.
wiki
Comments
Post a Comment