> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/ios/page-manipulation/thumbnails-view-i.md).

# Manipulate pages with thumbnail browser on iOS

Discover how to use the PTThumbnailsViewController class to view, navigate, and edit pages in a PTPDFViewCtrl. Learn how to add the Tools library to your project and interact with thumbnail images eff

The [`PTThumbnailsViewController`](https://sdk.apryse.com/api/ios/Classes/PTThumbnailsViewController.html) class allows users to view and navigate the pages of a [`PTPDFViewCtrl`](https://sdk.apryse.com/api/ios/Classes/PTPDFViewCtrl.html) as well as re-arrange and remove pages.

![](https://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%2Fuploads%2Fgit-blob-21fa8f7e1ba4dd11522bd4a8e88d7df36f1d9e4e%2F92522c0a1a539e45ee406bb261691501e9cdeef5-1242x2208.png?alt=media)

*The page thumbnails control is part of the Tools library, so make sure you have* [*added the Tools library to your project*](/ios/ui-customization/setup.md)*.*

## Show a page thumbnails view controller

To create a new page thumbnails view controller instance and display it from another view controller, supply a `PTPDFViewCtrl` instance to the `PTThumbnailsViewController` designated initializer:

{% tabs %}
{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
// Initialize thumbnails view controller with a PTPDFViewCtrl instance.
let thumbnailsViewController = PTThumbnailsViewController(pdfViewCtrl: pdfViewCtrl)

let navigationController = UINavigationController(rootViewController: thumbnailsViewController)
self.present(navigationController, animated: true, completion: nil)
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
// Initialize thumbnails view controller with a PTPDFViewCtrl instance.
PTThumbnailsViewController *thumbnailsViewController = [[PTThumbnailsViewController alloc] initWithPDFViewCtrl:pdfViewCtrl];

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:thumbnailsViewController];
[self presentViewController:navigationController animated:YES completion:nil];
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**The thumbnails view controller does not create its own top navigation bar, so it must be pushed onto a navigation controller's stack in order for the top navigation bar and 'Edit' button to be shown.**
{% endhint %}

## Populate the view controller with thumbnail images

The thumbnail images shown in the thumbnails view controller are generated by the `GetThumbAsync:` method of the `PTPDFViewCtrl` class. When ready, the thumbnail images are provided to the `pdfviewCtrl`'s delegate via the `GotThumbAsync:thumbImage:` method.

In your class adopting the `PTPDFViewCtrlDelegate` protocol (usually the same view controller presenting the thumbnails view controller), add the following:

{% tabs %}
{% tab title="Swift" %}
{% code lineNumbers="true" %}

```swift
func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl!, gotThumbAsync page_num: Int32, thumbImage image: UIImage!) {
    // Ensure thumbnails view controller is presented.
    if self.thumbnailsViewController.presentingViewController != nil {
        self.thumbnailsViewController.setThumbnail(image, forPage: Int(page_num))
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
- (void)pdfViewCtrl:(PTPDFViewCtrl *)pdfViewCtrl gotThumbAsync:(int)page_num thumbImage:(UIImage*)image {
    if (!image) return;
    
    // Ensure thumbnails view controller is presented.
    if (self.thumbnailViewController.presentingViewController) {
        [self.thumbnailViewController setThumbnail:image forPage:page_num];
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}

## Interact with the view controller

{% endhint %}

Pages can be re-arranged and removed in edit-mode, which is activated by the 'Edit' button in the navigation bar. Long-pressing and dragging allows the user to move a page to a different location in the same document, and tapping one or more documents selects them for removal with the trash can icon. The user is prompted for confirmation before any pages are permanently removed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/ios/page-manipulation/thumbnails-view-i.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
