سؤال

أنا بحاجة لإنشاء 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/applicationkit/classes/nsimage_class/reference/reference.html#//apple_ref/occ/instm/nsimage/initwithcontentsofurl:

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top