Skip navigation.
 
mlAdding subviews to a PDFView
FROM : Antonio Nunes
DATE : Sun Nov 11 20:42:26 2007

Hi,

I use a PDFView to show PDF documents. I need to add an NSTextView as 
a subview of its documentView to provide editing capabilities (and 
using an annotation text widget won't cut it unfortunately). However, 
the view coordinates that convertRect:fromPage: provides return 
coordinates relative to the PDFView itself, not to its underlying 
documentView, so I know of no way to obtain the correct offset for the 
target page. Further, when zooming the PDFView, the NSTextView won't 
scale along. It remains at constant size. This is surprising since I 
would have thought the documentView or one of its superviews to be 
scaled, but apparently, this is not the case and it looks rather like 
something below the documentView is scaled.

I tried adding the text view as a subview of the PDFView directly, and 
that allows me to place it on the correct page, and it all functions 
perfectly fine until the PDFView either gets zoomed or scrolled. The 
NSTextView will neither zoom nor scroll.

So that begs the question:
What is the correct way to add subviews to a PDFView such that they 
can be correctly positioned, and will zoom and scroll along with their 
superView(s)?
If there is no proper way to do it, any hints as to how to hack my way 
around it? I could live with a solution that creates direct subview's 
of the PDFView as long as I can make them scale and scroll along with 
the view's contents.

-António

----------------------------------------------------
It is better to light a candle than to curse the darkness
----------------------------------------------------

Related mailsAuthorDate
mlAdding subviews to a PDFView Antonio Nunes Nov 11, 20:42
mlRe: Adding subviews to a PDFView Joel Norvell Nov 12, 18:46
mlRe: Adding subviews to a PDFView Antonio Nunes Nov 12, 19:21
mlRe: Adding subviews to a PDFView John Calhoun Nov 14, 20:54
mlRe: Adding subviews to a PDFView Antonio Nunes Nov 14, 21:55
mlRe: Adding subviews to a PDFView Alexander Griekspo… Nov 15, 00:50