Skodik.o
Skodik.o

Reputation: 514

Draw image above pdf iOS 5

Iam making a simple app, I display pdf file with some text and images in it. Over that basic layer I would like to have another layer, this layer would be placed over image and when user touch inside this layer/view/rectangle something would happen. I would like to ask you if this is possible and are there any blocking point and what would be the best approach to achieve this goal. Thank you in advice :)

Upvotes: 0

Views: 673

Answers (1)

javieralog
javieralog

Reputation: 1337

Yes, it's possible.

I think the best approach is to draw the PDF file with CoreGraphics CGPDFDocument and CGPDFPage APIs. To add your extra layers above, you could use one of the following:

  • Use subviews of your PDF rendering view.
  • Use CALayer to add sublayers into your PDF rendering view's main layer.
  • Draw your content in the same layer as the PDF layer.

With the first solution, you get the touch adding UITapGestureRecognizer to the subviews. With the other two, you add the gesture recognizer to your PDF view and then have to claculate where did the user tapped.

Upvotes: 2

Related Questions