Search code examples
objective-cxcodemacoscocoapdfview

How to change PDFView annotation background color in Xcode?


I have use PDFView to add annotations to PDF pages. However the annotations' background color is transparent red by default. Is it possible to change the annotation background color?

And also I found the resize spot is very small, can I change the resize spot size too?

Thanks a lot. I have attached a screenshot.

Red background


Solution

  • Got the answer. Change the code in DrawPage:

    path = [NSBezierPath bezierPathWithRect: bounds];
        [path setLineJoinStyle: NSRoundLineJoinStyle];
    
        [[NSColor colorWithDeviceRed: 0.0 green: 0.0 blue: 0.0 alpha: 0.1] set]; 
    //change Here
    
         [path fill];
        [[NSColor blackColor] set];