Using QLPreviewController to scroll through PDF horizontally - objective-c

Hello i'm currently using QLPreviewController to view a pdf for a magazine app, but i want to have horizontal scrolling, i have got PSPDFKIT (think it's called that) and FastPDF to work fine but i don't have the money to pay for the liencese and don't wish to leave the water mark. is there any way to get QLPreviewController to view horizontally or even UIDocumentInteractionController to view horizontally.

Have you checked out this UIImage category? https://github.com/mindbrix/UIImage-PDF
You could use that to create a UIImage and add that to a UIScrollView. If you have separate PDF files for each page, you can create a UIImage for each one and create a horizontal scroll.
If you need to deal with multipage PDFs, then look at the file PDFView.m lines 43 & 83 - here it is assuming you always want page 1, it should be relatively trivial to add a property for the page number you wish to render instead.

Related

Efficiently Scroll and Zoom Photos Using UIScrollView and UIImageView

I need a simple way of scrolling through photos and zooming each photo as needed. Just like original Apple's Photo app. I understand the concept: UIScrollView has many UIScrollView subviews as pages and each of those has a UIImageView to zoom in.
However, I've also seen an example, which I can no longer find, with more efficient way of doing this - using only 3 pages (UIScrollView's) for as many photos as there are to save memory usage. So basically, if there are 10 photos, only 3 pages shown (centered visible, left hidden, right hidden) and as you scroll left or right new images are being placed into those pages to simulate an effect of continuous scroll.
My question is how is this done or is there an existing example so I do not reinvent the wheel?
You might wanna take a look at MWPhotoBrowser, it's pretty the same as the Photo app.
https://github.com/mwaterfall/MWPhotoBrowser

What is the best way to create a composite scrollable view on iOS

I need to create a scrollable composite view on iOS. That is to say, the view will contain at least one image, possibly a button, and some text (that we may wish to format with bold fonts, etc). The amount of data, and particularly the amount of text, is variable, from maybe 4 lines to maybe 100. The data is "variable" to a degree, and in particular the image and text do not come joined at the hip.
This all needs to fit in a "pane" of about 280h x 115w pixels in a portrait-only layout.
A single UITextView doesn't provide the facilities to display an image or format the text.
A UIWebView provides the ability to display the image and formatted text, but the button is a problem (not even sure if it's doable).
A UIScrollView would easily allow the image and button, and then a UIWebView could be embedded in the scroll view for the text, but then scrolling becomes a problem -- I'd like the entire view to scroll as one, without having to resize the web view to contain it's content, and without the confusion of a scrollable within a scrollable (the doc warns of "unexpected behavior").
(I'm guessing your thoughts at this point are that I want too much.)
So, any suggestions? What's the best way to get close to what I need here?
In iOS5 the UIWebView has a scrollView property, which is a normal UIScrollView. You should be able to add a UIButton as a subview of the scrollView to achieve what you want, although positioning it correctly may be a challenge. Prior to iOS5 you could cycle through the subviews of the UIWebView to find the UIScrollView with isKindOfClass...
I suggest testing with a UIWebView inside your UIScrollView. I don't see any interference in the iOS 5.0 simulator. I don't know if there are problems in iOS 4.0.
If you find that there is interference, you can prevent it by setting the web view's userInteractionEnabled property to NO, either in the nib or in code. This will prevent the web view from receiving any touches, so the user also won't be able to pinch-zoom it, follow links in it, or copy text from it.
In the web view's delegate, implement webViewDidFinishLoad: to set the web view's size and the scroll view's contentSize. For example:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
CGRect frame = self.webView.frame;
frame.size = [self.webView sizeThatFits:CGSizeMake(frame.size.width, HUGE_VALF)];
self.webView.frame = frame;
self.scrollView.contentSize = CGSizeMake(CGRectGetMaxX(frame), CGRectGetMaxY(frame));
}
When I did a similar thing, I had a dozen of views which I added to the UIScrollView and then calculated the frames of all the views. Granted, it was an extremely tedious work, given that some views could get hidden under various conditions. The layout code was actually pretty simple, laying out views from top to bottom, but ugly. The upshot is that it works like a charm, fast and reliably. You can even trivially wrap it in an animation block.

How can I add shiny surface to UITableView

How can I add shiny surface to UITableView
This is done easily. From the screenshot you supplied it appears that most of what you're pointing out is photoshopped images positioned with UI elements supplied from within Xcode and customized via code.
The tableView for example appears to be on a Grouped Table View laying on top of a photoshopped textured image. The tableView itself has a custom color to all the cells and a custom color and shadow to the cell separators. You can use Google to see how to customize a UITableView pretty easily.
But like said, most of this is from the magic of Photoshop.
Create your own views and photoshop them.

Loading PDF's to an iPad split view

I'm working on a split view application that is used to view PDF files in a webView. Right now I am able to get three PDF's loaded to the app, and have their titles displayed in the table in the RootView. I'm able to select them and have them displayed to the DetailView, however the sizing the of PDF isn't what I want it to be.
My hope is that the PDF will take up the whole screen and will resize itself to fit the screen if it is too large or too small. One PDF I have is too large and I have to scroll left or right to view the sides of the file, another I have is too small, it isn't centered and instead pushed to the left side of the screen and the empty side on right is filled in with black.
How do I make it so that the PDF's size themselves correctly to fit the whole screen and have even margins on the sides?
Thanks in advance!
Lots of PDF questions on SO today. Sounds like you may have to abandon the webview and go to a tiledlayer CGPDFDocument route. Check out the answer I just posted at Reading text and images from a pdf document in iOS

Easy way to use an UIScrollView

Does someone have an "easy way" to make a view like camera roll app? I need to display miniature photos (buttons) and push new views from them. I don't know how to display miniature images in a scroll view. The number of miniatures is large, so they don't fit the screen, and I think UIScrollView is the only solution.
Check out TTThumbsViewController, part of Three20; this should pretty much do what you want (and it's open source if you need to change it).
A scroll view really just controls the visible region of a single content view. If you want a grid of small images, you'll need to create a view that contains a number of image views or otherwise displays the grid of images. Make this the content view of the scroll view. Also, it'd be a good idea to construct your image grid view such that it only loads and draws the images that are visible, particularly if you're going to display a large number of such images.