开发者

How to open an Image on a Mac

开发者 https://www.devze.com 2023-02-16 00:35 出处:网络
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 woul

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

精彩评论

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