简体   繁体   中英

Loading an image from bytes in Objective-C

I'm working with an existing code base that accepts bytes from a loaded jpeg file and creates a UIImage object. That works fine on iphone but macOS needs a different implementation from what I've understood.

UIImage* image = [UIImage imageWithData:[NSData dataWithBytes:data length:length]];
if (image)
{

}

What is the equivalent of this on macOS? is it NsImage? How do I implement this?

Here it is

NSImage* image = [[NSImage alloc] initWithData:[NSData dataWithBytes:data length:length]];
if (image)
{

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM