You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+38-6
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@
7
7
8
8
[](https://flattr.com/submit/auto?user_id=mwaterfall&url=https://github.com/mwaterfall/MWPhotoBrowser&title=MWPhotoBrowser&language=&tags=github&category=software)
9
9
10
-
## A simple iOS photo browser with optional grid view, captions and selections.
10
+
## A simple iOS photo and video browser with optional grid view, captions and selections.
11
11
12
-
MWPhotoBrowser can display one or more images by providing either `UIImage` objects, or URLs to files, web images or library assets. The photo browser handles the downloading and caching of photos from the web seamlessly. Photos can be zoomed and panned, and optional (customisable) captions can be displayed.
12
+
MWPhotoBrowser can display one or more images or videos by providing either `UIImage` objects, `PHAsset` objects, or URLs to library assets, web images/videos or local files. The photo browser handles the downloading and caching of photos from the web seamlessly. Photos can be zoomed and panned, and optional (customisable) captions can be displayed.
13
13
14
14
The browser can also be used to allow the user to select one or more photos using either the grid or main image view.
15
15
@@ -32,7 +32,7 @@ Works on iOS 7+. All strings are localisable so they can be used in apps that su
32
32
33
33
## Usage
34
34
35
-
MWPhotoBrowser is designed to be presented within a navigation controller. Simply set the delegate (which must conform to `MWPhotoBrowserDelegate`) and implement the 2 required delegate methods to provide the photo browser with the data in the form of `MWPhoto` objects. You can create an `MWPhoto` object by providing a `UIImage` object, or a URL containing the path to a file, an image online or an asset from the asset library.
35
+
MWPhotoBrowser is designed to be presented within a navigation controller. Simply set the delegate (which must conform to `MWPhotoBrowserDelegate`) and implement the 2 required delegate methods to provide the photo browser with the data in the form of `MWPhoto` objects. You can create an `MWPhoto` object by providing a `UIImage` object, `PHAsset` object, or a URL containing the path to a file, an image online or an asset from the asset library.
36
36
37
37
`MWPhoto` objects handle caching, file management, downloading of web images, and various optimisations for you. If however you would like to use your own data model to represent photos you can simply ensure your model conforms to the `MWPhoto` protocol. You can then handle the management of caching, downloads, etc, yourself. More information on this can be found in `MWPhotoProtocol.h`.
38
38
@@ -41,10 +41,17 @@ See the code snippet below for an example of how to implement the photo browser.
@@ -57,7 +64,7 @@ browser.zoomPhotosToFill = YES; // Images that almost fill the screen will be in
57
64
browser.alwaysShowControls = NO; // Allows to control whether the bars and controls are always visible or whether they fade away to show the photo full (defaults to NO)
58
65
browser.enableGrid = YES; // Whether to allow the viewing of all the photo thumbnails on a grid (defaults to YES)
59
66
browser.startOnGrid = NO; // Whether to start on the grid of thumbnails instead of the first photo (defaults to NO)
60
-
browser.wantsFullScreenLayout = YES; // iOS 5 & 6 only: Decide if you want the photo browser full screen, i.e. whether the status bar is affected (defaults to YES)
67
+
browser.autoPlayOnAppear = NO; // Auto-play first video
61
68
62
69
// Optionally set the current visible photo before displaying
63
70
[browser setCurrentPhotoIndex:1];
@@ -88,7 +95,32 @@ Then respond to the required delegate methods:
88
95
89
96
You can present the browser modally simply by wrapping it in a new navigation controller and presenting that. The demo app allows you to toggle between the two presentation types.
90
97
91
-
If using iOS 5 or 6 and you don't want to view the photo browser full screen (for example if you are using view controller containment) then set the photo browser's `wantsFullScreenLayout` property to `NO`. This will mean the status bar will not be affected by the photo browser.
98
+
99
+
### Videos
100
+
101
+
You can represent videos in MWPhoto objects by providing a standard MWPhoto image object with a `videoURL`. You can also use a `PHAsset` object or a URL to an assets library video.
// Video grid thumbnail for video with no poster photo
120
+
MWPhoto *videoThumb = [MWPhoto new];
121
+
videoThumb.isVideo = YES;
122
+
123
+
```
92
124
93
125
94
126
### Grid
@@ -104,7 +136,7 @@ The photo browser can also start on the grid by enabling the `startOnGrid` prope
104
136
105
137
### Actions
106
138
107
-
By default, if the action button is visible then the image (and caption if it exists) are sent to a UIActivityViewController. On iOS 5, a custom action sheet appears allowing them to copy or email the photo.
139
+
By default, if the action button is visible then the image (and caption if it exists) are sent to a UIActivityViewController.
108
140
109
141
You can provide a custom action by implementing the following delegate method:
0 commit comments