简体   繁体   中英

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?

{
    "/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}}";

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. They are of by a magnitude of 10^30

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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