1

カスタムビュー(NSView)からサムネイルビュー(画像ではない)を作成するにはどうすればよいですか?

カスタムNSViewのコンテンツが変更された場合、そのサムネイルビューも変更されます。

ibookauthorのようです。

皆さんありがとう。

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

4

1 に答える 1

2

次回はもう少しグーグルをして、何を試したか教えてください。とにかく答えます。

を使用して、サムネイルを含むを作成することをNSViewお勧めします。以下は私のアプリで使用するものです:-(void)cacheDisplayInRect:toBitmapImageRep:NSImage

- (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];
}

または、利用可能な他のさまざまな方法を使用します。

NSViewの「スクリーンショット」を撮るにはどうすればよいですか?

グーグル

于 2012-06-13T19:43:30.173 に答える