Вопрос

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

Спасибо

Это было полезно?

Решение

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

 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/applyationkit/Classes/nsimage_class/Reference/Reference.html#//apple_ref/occ/instm/nsimage/initwithcontentsofurl.:

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top