简体   繁体   English

iOS 中的 PDFKit 注释框架的注释字典值返回 NSRect

[英]PDFKit in iOS Annotation dictionary value for annotation frame returns NSRect

how does one take an the value of NSRect shown below and convert it to a CGRect?如何获取如下所示的 NSRect 的值并将其转换为 CGRect?

{
    "/A" = (null);
    "/Border" = "PDFBorder: {solid lineWidth:1.0 hCorner:0.0 vCorner:0.0 dashCount:0 dashPattern:(\n)}";
    "/DA" = "/Helvetica-Bold 12 Tf 0 g";
    "/F" = 4;
    "/FT" = "/Btn";
    "/Ff" = 65536;
    "/MK" = "<PDFAppearanceCharacteristics: 0x600002702eb0>";
    "/Rect" = "NSRect: {{61.825100000000006, 230.45099999999999}, {212.82389999999998, 38.096000000000032}}";
    "/Subtype" = "/Widget";
    "/T" = "signature_af_image";
    "/Type" = "/Annot";
}

this is the value in question:这是有问题的价值:

"/Rect" = "NSRect: {{61.825100000000006, 230.45099999999999}, {212.82389999999998, 38.096000000000032}}"; "/Rect" = "NSRect: {{61.825100000000006, 230.45099999999999}, {212.82389999999998, 38.096000000000032}}";

I've tried casting this like so, and while this seems to work, the values inside the CGRect don't match the values inside the NSRect.我已经尝试过这样转换,虽然这似乎可行,但 CGRect 中的值与 NSRect 中的值不匹配。 They are of by a magnitude of 10^30它们的大小为 10^30

CGRect tempRect = (__bridge CGRect )[annot.annotationKeyValues objectForKey:PDFAnnotationKeyRect]; CGRect tempRect = (__bridge CGRect )[annot.annotationKeyValues objectForKey:PDFAnnotationKeyRect];

so casting doesn't work所以铸造不起作用

i'm an idiot, the answer is already in documentation with我是个白痴,答案已经在文档中

// Required for all annotations. // 所有注释都需要。 The bounding box in page-space of the annotation.注释的页面空间中的边界框。

@property (nonatomic) PDFRect bounds;

oh well, this works哦,好吧,这行得通

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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