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

后端 未结 5 910
梦毁少年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 20:08

    New API has been added since iOS 7, that should provide efficient way of getting snapshot

    • snapshotViewAfterScreenUpdates: renders the view into a UIView with unmodifiable content

    • resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets : same thing, but with resizable insets

    • drawViewHierarchyInRect:afterScreenUpdates: : same thing if you need all subviews to be drawn too (like labels, buttons...)

    You can use the UIView returned for any UI effect, or render in into an image like you did if you need to export.

    I don't know how good this new method performs VS the one you provided (although I remember Apple engineers saying this new API was more efficient)

提交回复
热议问题