开发者

Adding subview to view with a PDFView as a subview

开发者 https://www.devze.com 2023-02-17 03:15 出处:网络
I have a controller view. This controller has a PDFView as a subview and another subview which is like a cont开发者_开发问答roller to the pdf.

I have a controller view. This controller has a PDFView as a subview and another subview which is like a cont开发者_开发问答roller to the pdf.

Adding subview to view with a PDFView as a subview

The problem is that if I do the following in the controller:

self.view addSubview:pdfView];
[self.view addSubview:pdfController];

The pdfController lays on the pdfView, but it will scroll with the pdf if you scroll it. I want to make pdfController view to be immobile and to just sit on the pdfView. Does anyone know how to get this behavior?


I remember having similar trouble trying to overlay an NSView over a PDFView with an app I was writing a few years ago. Assuming you've tried messing with the NSScrollView's copyOnScroll and the various autoresizing options, a good solution is to put the controller view in a separate child window that overlays the window your PDFView is in. You'll need to do a little work to synchronize behavior between the two windows, but in the end you won't have any of the weird problems that happen when you try to overlap sibling views like that.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号