
NSImage * picture = [[NSImage alloc] initWithContentsOffile: [bundleRoot stringByAppendingString:tString]]; NSLog(@"sixe %d %d",picture.size.wIDth,picture.size.height); if( picture ){ NSLog(@"Picture is not null"); }else { NSLog(@"Picture is null."); } 谢谢
解决方法 加载图像的代码是正确的.显示大小的代码不正确; NSSize的成员是CGfloat,应使用%f格式字符串打印:
NSLog(@"size %f %f",picture.size.height);总结
以上是内存溢出为你收集整理的cocoa – 如何将PNG图像读取到NSImage全部内容,希望文章能够帮你解决cocoa – 如何将PNG图像读取到NSImage所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)