iPhone iOS how to flip/reflect any UIView in - place?

后端 未结 2 1991
甜味超标
甜味超标 2021-02-15 17:16

I know how to flip/reflect/rotate a UIImage by re-drawing it within it\'s bounds.

- (IBAction)reflectImageView:(UIImageView)imageView {

    UIGraphicsBeginImag         


        
2条回答
  •  野的像风
    2021-02-15 17:50

    You can make a "screenshot" of any View by

    UIGraphicsBeginImageContext(self.view.frame.size);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    

    and then flip the UIImage and add a UIImageView with the resulting Image below the view.

提交回复
热议问题