How Do I Take a Screen Shot of a UIView?

后端 未结 15 2765
-上瘾入骨i
-上瘾入骨i 2020-11-22 09:28

I am wondering how my iPhone app can take a screen shot of a specific UIView as a UIImage.

I tried this code but all I get is a blank image

15条回答
  •  余生分开走
    2020-11-22 09:32

    I think you may want renderInContext, not drawInContext. drawInContext is more a method you would override...

    Note that it may not work in all views, specifically a year or so ago when I tried to use this with the live camera view it did not work.

提交回复
热议问题