I'm developing an iPad app where I want to annotate things on a pdf. I subclassed PDFAnnotation to drag text on a pdf. When I use Xcode 26 everything is working fine and everything is rendered perfect. But when I run the same code with Xcode 27 on iOS27 I get a pixelated annotation.
iOS26
iOS27
The code:
import UIKit
final class ManualPlacementPreviewAnnotation: PDFAnnotation, DraggablePreviewAnnotation {
private let text: String
private let textFont: UIFont
private let textColor: UIColor
var isGrabbed = false
init(bounds: CGRect, text: String, font: UIFont, color: UIColor) {
self.text = text
self.textFont = font
self.textColor = color
super.init(
bounds: bounds.insetBy(dx: -PreviewAnnotationChrome.padding, dy: -PreviewAnnotationChrome.padding),
forType: .freeText,
withProperties: nil
)
}
required init?(coder: NSCoder) {
text = ""
textFont = .systemFont(ofSize: 12)
textColor = .black
super.init(coder: coder)
}
override func draw(with box: PDFDisplayBox, in context: CGContext) {
context.saveGState()
context.translateBy(x: 0, y: bounds.minY + bounds.maxY)
context.scaleBy(x: 1, y: -1)
let content = contentBounds
UIGraphicsPushContext(context)
NSAttributedString(string: text, attributes: [
.font: textFont,
.foregroundColor: textColor,
]).draw(in: content)
UIGraphicsPopContext()
PreviewAnnotationChrome.draw(context, around: content, grabbed: isGrabbed)
context.restoreGState()
}
}
Is this a bug in iOS27 or am I doing something wrong?