resizeImageWithCapInsets为NSImage? [英] resizableImageWithCapInsets for NSImage?

查看:243
本文介绍了resizeImageWithCapInsets为NSImage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UIKit 中,我们有 - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets

AppKit 中有类似的东西用于创建tileable NSImage p>

Is there something similar in AppKit for creating a tileable NSImage?

推荐答案

不适用。 NSImage不包含这样的智能。

Nope. NSImage contains no such smarts. You will have to chop up, resize, and reassemble the image yourself.

您可以考虑制作一个NSCustomImageRep子类来实现这一点,然后您可以使用它来实现一个OS X版本的方法相同。

You might look into making an NSCustomImageRep subclass that implements this, which you could then use to implement an OS X version of the same method.

这篇关于resizeImageWithCapInsets为NSImage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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