ios - Large UIImage not showing in UIImageView -
i'm capturing full page screenshot of uiwebview , passing image through segue:
// webviewcontroller.swift override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "capturesegue" { var captureviewcontroller:captureviewcontroller = segue.destinationviewcontroller as! captureviewcontroller captureviewcontroller.tempcaptureimage = image } }
the uiimage being saved documents/images
in application directory fine. if open file system shows fine in preview. however, if screenshot large, images won't show in uiimageview. uiimageview renders blank. adding breakpoint shows image data there, not rendering.
// captureviewcontroller.swift var tempcaptureimage: uiimage? @iboutlet weak var imagescrollview: uiscrollview! @iboutlet weak var captureimageview: uiimageview! @iboutlet weak var titlefield: uitextfield! override func viewdidload() { super.viewdidload() self.automaticallyadjustsscrollviewinsets = false } override func viewdidappear(animated: bool) { super.viewdidappear(animated) if let image = tempcaptureimage { captureimageview.frame = cgrect(origin: cgpoint(x: 0, y: 0), size: image.size) captureimageview.image = image imagescrollview.contentsize = image.size let scrollviewframe = imagescrollview.bounds let scalewidth = scrollviewframe.size.width / imagescrollview.contentsize.width let scaleheight = scrollviewframe.size.height / imagescrollview.contentsize.height let minscale = min(scalewidth, scaleheight); imagescrollview.minimumzoomscale = minscale; imagescrollview.maximumzoomscale = 1.0 imagescrollview.zoomscale = minscale; } }
could because image large? if pages capture smaller, images show fine. there recommended techniques viewing large images on idevices?
edit:
here output of variables view breakpoint. maybe see i'm missing.
you not give info on how large image is, it's impossible limit might hitting. remember, though, triple-scale image multiplies underlying bitmap memory size 9 in comparison single-scale image. that's order of magnitude! can believe exceed memory capacity of app , crash if tried access image that's large. step 1 surely load image single-scale image; see imageio framework learn how that. see docs on catiledlayer if want know how display large image.
Comments
Post a Comment