开发者

Get small "preview" of view controller

I want to be able to dynamically get a "preview" of view controllers in my navigation stack if possible.

So if I know the class of the view controller (or indeed have the object) is there anyway to get a "screenshot" or a "previe开发者_运维技巧w" of it? I don't mind if its a uiview or a flat image. :)

Thanks

Tom


#import <QuartzCore/QuartzCore.h>

and

UIGraphicsBeginImageContext(viewcontroller.view.bounds.size);
[viewcontroller.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *preview = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜