ios - UIImage size is changing -
currently have split , want split 2 different images.
i have working, isn't getting frame correctly.
// @property of uiimage self.splitimage = [_displaylastphoto image]; nslog(@"split image %f %f", self.splitimage.size.width, self.splitimage.size.height); [self setviewshow:self.successfulmessage]; cgimageref tmpimgref = self.splitimage.cgimage; cgimageref leftimgref = cgimagecreatewithimageinrect(tmpimgref, cgrectmake(0, 0, self.splitimage.size.width / 2.0, self.splitimage.size.height)); uiimage *leftimage = [uiimage imagewithcgimage:leftimgref]; nslog(@"left image %f %f", leftimage.size.width, leftimage.size.height); cgimagerelease(leftimgref); cgimageref rightimgref = cgimagecreatewithimageinrect(tmpimgref, cgrectmake(self.splitimage.size.width / 2.0, 0, self.splitimage.size.width / 2.0, self.splitimage.size.height)); uiimage *rightimage = [uiimage imagewithcgimage:rightimgref]; nslog(@"right image %f %f", rightimage.size.width, rightimage.size.height); cgimagerelease(rightimgref);
so right right side image + left side image width should equal _displaylastphot
's width. isn't.
edit hardcoded width , height match _displaylastphoto
width , height , matches. left , right images seemed zoomed in.
i go doing this:
- use uiimage size , not frame of diplaying uiimageview
- create images sizes using bounds' not frame's width , height
- remove aspect fit or whatever scaling on uiimageview when doing visual sanity checks. scale after verified images split correctly
good luck
Comments
Post a Comment