NSImage с URL сайта
-
27-09-2019 - |
Вопрос
Мне нужно создать 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.
Не связан с StackOverflow