1 year ago

#199424

test-img

Young Shway

Causing a subview to scroll with its superview

Had to cover a subclass of PDFView with an NSView to draw lines and texts, as PDFPage or PDFAnnotation don't seem to work at all. Successfully added the subview, showed a random text, but the problem is when I tried to scroll, only the underlining PDFView is scrolling, its subview (NSView) is standing still. Codes are as following: (m_markingView is NSView, m_drawing is PDFView)

m_markingView = [[CLMarkingView alloc] initWithFrame:m_drawing.bounds];
[m_drawing addSubview:m_markingView];
[m_drawing setNeedsDisplay:YES];

Anyone has any idea? Many thanks! (PS: PDFPage and PDFAnnotation work only at the start of the page, when you scroll the PDFView, all the lines and annotations will go away without ever coming back.)

nsview

addsubview

nsscrollview

pdfview

pdfpage

0 Answers

Your Answer

Accepted video resources