如何获得Iphone上下文的大小

时间:2022-04-19 07:31:13

I have;

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextRef context = UIGraphicsGetCurrentContext();

Now I want to know the width/height of the the context (in pixels); any way to do this?

现在我想知道上下文的宽度/高度(以像素为单位);任何方式这样做?

1 个解决方案

#1


You can't get that information from the CGContextRef object, but from the surrounding frame object:

您无法从CGContextRef对象获取该信息,而是从周围的框架对象获取:

self.frame.size.width
self.frame.size.height

#1


You can't get that information from the CGContextRef object, but from the surrounding frame object:

您无法从CGContextRef对象获取该信息,而是从周围的框架对象获取:

self.frame.size.width
self.frame.size.height