[iOS]How to make a “snapshot” of the current view's state

前端 未结 3 351
误落风尘
误落风尘 2020-12-03 14:43

I need to make a snapshot or a screenshot - call it as you like- of the current view and then display it in the modal view.

Because if I just write this in the Moda

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 15:18

    In iOS 7, you can use one of the new methods in UIView for creating snapshots, for instance:

    - (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates;
    

    which returns a UIView which you can then add as a subview.

提交回复
热议问题