簡體   English   中英

在 Objective-C 中從字節加載圖像

[英]Loading an image from bytes in Objective-C

我正在使用一個現有的代碼庫,它接受來自加載的 jpeg 文件的字節並創建一個 UIImage 對象。 這在 iphone 上運行良好,但 macOS 需要與我所理解的不同的實現。

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

}

這在 macOS 上的等價物是什么? 是 NsImage 嗎? 我該如何實施?

這里是

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

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM