NSImage с веб-сайта URL - PullRequest
       13

NSImage с веб-сайта URL

4 голосов
/ 18 апреля 2010

Мне нужно создать NSImage из URL, а затем установить его для просмотра изображений в моем приложении. Я попробовал какой-то код, который нашел в Интернете, но он не работал. Если кто-нибудь знает, как это сделать, любая помощь будет великолепна.

Спасибо

1 Ответ

5 голосов
/ 18 апреля 2010

Вы хотите посмотреть на

 initWithContentsOfURL:
Initializes and returns an NSImage instance with the contents of the specified URL.

- (id)initWithContentsOfURL:(NSURL *)aURL

Parameters
aUrl
The URL identifying the image.
Return Value
An initialized NSImage instance, or nil if the method cannot create an image representation from the contents of the specified URL.

С http://developer.apple.com/mac/library/documentation/cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/occ/instm/NSImage/initWithContentsOfURL:

...