Why does my programmatically created screenshot look so bad on iOS 7?

后端 未结 5 897
梦毁少年i
梦毁少年i 2020-11-29 19:46

I am trying to implement sharing app with facebook. I used this code to take the screenshot:

CGSize imageSize = CGSizeMake(self.view.bounds.size.width, self.         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 19:55

    in iOS 8 : this is how i am doing to get ScreenShot

    1. just added one UIImageView and Method to take screenshot in .h file

    @property (weak, nonatomic) IBOutlet UIImageView *imageView;

     -(IBAction)takeSnapShot:(id)sender;
    

    2 added code snip for taking screen shot and set on UIImageView in .m file

    - (IBAction)takeSnapShot:(id)sender
    {
        UIGraphicsBeginImageContext(self.view.bounds.size);
        [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *snapShotImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
    
        imageView.image = snapShotImage;
    }
    
    1. below is the output i got.

    enter image description here

提交回复
热议问题