【问题标题】:Making IKImageView aware of my custom NSImageRep让 IKImageView 知道我的自定义 NSImageRep
【发布时间】:2014-06-20 21:38:59
【问题描述】:

在我的应用程序中,我编写了一个自定义 NSImageRep 来处理专有图像格式。应用程序的主视图是IKImageView,我打算将我自定义的NSImageRep 的图像加载到其中以供查看和操作。

如果我创建这些图像的CGImageRef,然后将引用传递给图像视图,它可以正常工作,但这并不理想。如果可能的话,我想使用IKImageViewsetImageWithURL: 方法,因为这是文档中提到的首选方法,而且它更简洁。不幸的是,该视图似乎完全不知道我的NSImageRep,并且根本无法加载图像。

有什么办法可以让图像视图理解自定义表示?

【问题讨论】:

    标签: objective-c cocoa nsimage ikimageview nsimagerep


    【解决方案1】:

    我认为您需要在应用启动的早期调用 NSImageRep 的 registerImageRepClass:。

    我很确定你还需要在你的子类中实现 imageUnfilteredTypes

    发件人:https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImageRep_Class/Reference/Reference.html#//apple_ref/occ/clm/NSImageRep/registerImageRepClass

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-26
      • 2018-04-09
      • 1970-01-01
      相关资源
      最近更新 更多