如何制作缩略图视图自定义视图(NSView)? [英] How do I make a thumbnail view form custom view(NSView)?

查看:141
本文介绍了如何制作缩略图视图自定义视图(NSView)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从自定义视图(NSView)中创建缩略图视图(不是图像)?

How do I make a thumbnail view (It's not image) form a custom view(NSView)?

如果自定义NSView的内容更改,则缩略图视图将被更改。

If the custom NSView's content changed that thumbnail view will be changed.

看起来像ibook的作者。

It's looks like ibook author.

谢谢。

https://plus.google.com/u/ 0 / photos / 114755931805273493604 / albums / 5753531972174581009

推荐答案

我建议您下次再使用Google搜索,然后告诉我们您尝试了什么,但无论如何我都会回答:

I suggest you do some more Googling next time, and tell us what you have tried, but I'll answer anyways:

您可能想使用 NSView -(void)cacheDisplayInRect:toBitmapImageRep:创建一个包含缩略图的 NSImage 。以下是我在我的应用程序中使用的东西:

You may want to use NSView's -(void)cacheDisplayInRect:toBitmapImageRep: to create an NSImage which contains the thumbnail. The following is what I use in an app of mine:

- (NSImage *)snapshotForRect:(NSRect)destinationRect {
    NSView *view = ... // view you want thumbnail of
    NSBitmapImageRep *imageRep = [view bitmapImageRepForCachingDisplayInRect:destinationRect];
    [view cacheDisplayInRect:destinationRect toBitmapImageRep:imageRep];
    NSImage *renderedImage = [[NSImage alloc] initWithSize:[imageRep
                                                            size]];
    [renderedImage addRepresentation:imageRep];
    return [renderedImage autorelease];
}

或使用其他各种可用方法。

Or use the variety of other methods available.

如何拍摄屏幕截图

Google

这篇关于如何制作缩略图视图自定义视图(NSView)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆