How to read PNG image to NSImage

后端 未结 2 723
轻奢々
轻奢々 2021-02-15 16:06

how can i read PNG image to NSImage. I tried the following way,but when i get the width and size of the image i\'m getting some weird value.. if any one can direct me in right p

2条回答
  •  爱一瞬间的悲伤
    2021-02-15 17:02

    Your code to load the image is correct.

    The code to display the size is incorrect; NSSize's members are CGFloat which should be print with the %f format string:

    NSLog(@"size %f %f",picture.size.width, picture.size.height);
    

提交回复
热议问题