Resizing button on PDF page pinch - ios

I am developing pdf application in iPhone. I am loading PDF page on view and UIview is on UIScrollView.
On pdf page i am adding custom button. Now i want to resize button on pdf page pinch. PDF pinch cause only resize button but . currently my PDF page is also resizing along with button.
So how to resize button on PDF page pinch?
Any help
Thanks

At the moment you're adding everything on the UIScrollView. You want to add your button to a different view layer that's on top of UIScrollView, but not within. This is a bit more complex, as you need to change the object position on every position/zoom change of the scrollview - but there are enough delegates so that this can be achieved pretty easy.

Related

Free Scrolling in Xcode 8.3.3

I want to create a page with a big image as background and buttons that users can interact with.
So imagine I put a big image such as a piece of map into the screen, but I only show a corner of the map in the display. So if a user wants to see other parts of the map, they have to "scroll" and navigate to wherever they want.
Meanwhile I also want to put a button they can tap on, and that button should lead to a php webpage (in-app, not opening in safari or else) or information page about sites and buildings in this location.
I am a rookie and I haven't have any code written down yet. I am thinking about using UIScrollView and UIButton, but am I on the right direction? Any advice?
Thanks in advance!
First you need a way to pinch zoom the image. In this mode, you can drag the image in any direction that you want. A common method can be found here. A scroll view can only scroll horizontally or vertically but with that image zooming, each image can be zoomed in and then dragged to any direction you want. You can have a scroll view with only one image.
After you have the image zooming ready, all you need to do is to create a subview on your screen to cover part of the image view or scroll view, whatever you used.

Want attached image type page control

I want below image as page control in iOS, iPhone.
There is no built-in way to make an image into a page control, but you can use a horizontal UIScrollView with your views embedded in it, then recreate the page control with UIViews for the circles and some resize animations, combined with programmatically scrolling the scroll view. I'm not sure if I answered your question, so if you need clarification leave a comment below this answer.

Pan and Pinch a UIImageView within a ScrollView

I have created a small app using a ScrollView w/ paging and a series of UIImageViews each representing a page. It acts similar to the Photos.app.
I want to be able to pan and zoom individually for each image (page of a scrollview).
What would be the most sound approach to do this? Should I replace the UIImageView page with a scrollview with a UIImage inside it? I would then have a main scroll view where each page of the scrollview had a scrollview with an image inside it that could be pinched,etc.
It seems like a messy approach. I am looking for a clean approach. Any suggestions?
Well, as far as I know the approach you suggest is the way it is done. I have used this to create a PDF viewer and once everything is in place it doesn't feel too messy.
You might want to use CATiledLayer as your inner (per-page) scrollview's layer (instead of CALayer) if these images you have are really big (which could well be the case since otherwise zooming in on them would not bring you much but pixelation, but this is just an assumption on my part).
Checkout UIPageViewController. This controller manages a view controllers for each page and transitions between them using effects like page curl or scroll.
In your case you would create a view controller that manages a scrollview for zoom & pan for each page.

How to implement a zoomable UIPageViewController when in Two Pages mode?

I need to implement a zoomable UIPageViewController in iOS 5 when in a two pages layout mode (in other words, when the Spine Location is set to Mid).
Using a scrollview for each page works fine when only one page is displayed. But when two pages are diplayed side-by-side in landscape mode, how can one seamless synch the pages and align the borders during the zoom animation?
One possible solution would be to put the UIPageViewController inside a bigger UIScrollView controller, but this yelds a blurred image because the two scrollviews inside the pages are not updated with a higer resolution area of the source images when the parent is zoomed.
It seems that is impossible to zoom inside a UIPageViewController when in two page mode. Is there someone who found a solution to this?
Thanks in advance.
I am still testing, but I have this.
I used the pageviewcontroller template.
I changed the scene to show a image instead a month (inside a UIImageView).
used a UIPinchGestureRecognizer to zoom the image and an UIPanGestureRecognizer to move the image once it is zoomed and it works.
The only problem is sometimes the page swipe is recognised instead the pan, so it changes the page instead moving the inside image.
And it only zooms a page at a time, I marked clip subviews in the view of the dataViewController, so 2 pages remains the same size even when you zoom in the other.

CATiledLayer is being rendered underneath a UIView

I'm making a PDF reader that looks like a real book.
I have a UIImageView inside a scrollview as the book's background (imagine an open book with empty pages). The UIImageView's layer has 2 sublayers each positioned over each page, CATiledLayers that render PDF content.
I have 2 UIViews whose layer uses an image as its contents. When I hit a button to turn the page, I take the CATiledLayer attached to the background and remove him but then add him to the UIView's layer as a sublayer. This UIView's layer animates a page turning, and with it animates that PDF page. I create a new PDF page and put it where the old one used to be.
So now there is a PDF page as a sublayer on the background UIImageView, and a UIView overtop of that with a PDF page as a sublayer. For some reason the PDF on the page underneath is visible during the animation. It should not be visible because the turning page should be obstructing it. Question is, why is that happening?
I just had to change the zPosition property of the UIView's layers to a really high number like 10000. I had it set to 0.1 initially but that wasn't enough. Then the compositing worked again.

Resources