Block annotation editing and deletion in iOS

To prevent the menu from being presented for selected annotations, implement the pdfViewController(\_:<wbr>menuForAnnotations:<wbr>onPageView:<wbr>appearance:<wbr>suggestedMenu:) delegate method and return an empty UIMenu(opens in a new tab):

func pdfViewController(_ sender: PDFViewController, menuForAnnotations annotations: [Annotation], onPageView pageView: PDFPageView, appearance: EditMenuAppearance, suggestedMenu: UIMenu) -> UIMenu {
UIMenu(children: [])
}

To prevent the selected annotations from being resized, override the allowResizing property of the ResizableView class and always return false from its getter:

class NotResizableView: ResizableView {
override var allowResizing: Bool {
get {
false
}
set {
// Do nothing.
}
}
}

Check out our overriding classes guide to learn more about the technique of subclassing Nutrient’s views.