开发者

How to open an Image on a Mac

In my app I want the user to either be able开发者_运维百科 to click a button browse for a file or drag and drop it into the application and have it open the image. How can I do this? Which method would be easiest or do you recommend?


In my app I want the user to either be able to click a button browse for a file

use NSOpenPanel, and specify the allowed types

or drag and drop it into the application and have it open the image. How can I do this? Which method would be easiest or do you recommend?

subclass NSDocument, and associate the document type with the image mime-type; this association is made in your app's plist resource.

unless you have special needs, you can use CGImage and/or NSImage apis to open the image.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜