ios - Splitting UiImageView in half horizontally? -
How do I go about dividing a UIImageView
half horizontally? I do not want two separate images, but my last purpose to declare two parts of more UiImageView
is that if my "ball" hits above a stage (top half) then He raises if the ball hits the lower half of the platform, then it bounces down.
- (zero) partition {UIImage * image = [UIImage imageNamed: @ "cat. Jpeg "]; CGImageRef imageRef = image.CGImage; CGImageRef leftRef = CGImageCreativeWithImageInRect (imageRef, CGRectMake (0, 0, image.size.width / 2, image.size.height)); UIImage * leftImage = [UIImage imageWithCGImage: leftRef]; CGImageRelease (leftRef); _imageView1.image = leftImage; CGImageRef rightRef = CGImageCreativeWithImageInRect (imageRef, CGRectMake (image.size.width / 2, 0, image.im.width, image.size.height)); UIImage * rightImage = [UIImage imageWithCGImage: rightRef]; CGImageRelease (rightRef); _imageView2.image = rightImage; }
Comments
Post a Comment