Skip to content

Commit 972e941

Browse files
committed
update readme
1 parent ec8113f commit 972e941

File tree

2 files changed

+22
-71
lines changed

2 files changed

+22
-71
lines changed

README.md

Lines changed: 22 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,46 @@
11
MHFacebookImageViewer
22
=======================
33

4-
A new Image Viewer inspired by Facebook
5-
6-
7-
## Screenshots
8-
9-
![Preview](http://i1102.photobucket.com/albums/g447/michaelhenry119/IOS%20Controls/MHFacebookImageViewer/demo1_zpse8778327.gif)
10-
11-
![Preview](http://i1102.photobucket.com/albums/g447/michaelhenry119/IOS%20Controls/MHFacebookImageViewer/Demo2_zps23b37e99.gif)
12-
13-
![Preview](http://i1102.photobucket.com/albums/g447/michaelhenry119/IOS%20Controls/MHFacebookImageViewer/Demo3_zps54985d8d.gif)
4+
An Image Viewer inspired by Facebook
145

6+
![Screenshot](images/demo-v3.gif)
157

168
# Demo Video
179

1810
http://youtu.be/NTs2COXxrrA
1911

2012

13+
# Supports
2114

22-
# Requirements
23-
24-
25-
* Current version can run from iOS 5 to iOS 7 (But must be build < XCode 4.6.x)
26-
* Please uncheck the Use AutoLayout in the property inspector of The UIStoryboard for IOS 5 Support ![Preview](http://i1102.photobucket.com/albums/g447/michaelhenry119/IOS%20Controls/MHFacebookImageViewer/ScreenShot2013-06-24at33149PM_zpsec274276.png)
27-
* [AFNetworking](https://github.com/AFNetworking/AFNetworking) - for image lazy loading
28-
29-
30-
# Usage
15+
- From iOS 10
16+
- Swift versions
17+
- Swift 4.0
18+
- Swift 4.2
19+
- Swift 5.0
3120

3221
## How to use it
33-
Just
34-
35-
#import "MHFacebookImageViewer.h"
36-
37-
38-
and then in your UIImageView after you set the Image just call the
39-
40-
### Single Image Support
41-
42-
- (void) setupImageViewer;
43-
44-
- (void) setupImageViewerWithCompletionOnOpen:(MHFacebookImageViewerOpeningBlock)open onClose:(MHFacebookImageViewerClosingBlock)close;
45-
46-
47-
or if you want to load other image (for example a hi-res version of that image)
48-
49-
- (void) setupImageViewerWithImageURL:(NSURL*)url;
50-
51-
- (void) setupImageViewerWithImageURL:(NSURL *)url onOpen:(MHFacebookImageViewerOpeningBlock)open onClose:(MHFacebookImageViewerClosingBlock)close;
52-
53-
### Multiple Images Support
54-
55-
- (void) setupImageViewerWithDatasource:(id<MHFacebookImageViewerDatasource>)imageDatasource onOpen:(MHFacebookImageViewerOpeningBlock)open onClose:(MHFacebookImageViewerClosingBlock)close;
56-
57-
- (void) setupImageViewerWithDatasource:(id<MHFacebookImageViewerDatasource>)imageDatasource initialIndex:(NSInteger)initialIndex onOpen:(MHFacebookImageViewerOpeningBlock)open onClose:(MHFacebookImageViewerClosingBlock)close;
58-
59-
60-
## Example (UITableViewController):
6122

62-
### In your UITableViewController import the MHFacebookImageViewer.h
23+
The simplest way to implement is with using `UIImageView().setupImageViewer(with: self)`
6324

64-
#import "MHFacebookImageViewer.h"
65-
66-
### In your [UITableView cellForRowAtIndexPath]
25+
```swift
26+
imageView.setupImageViewer(with: self)
27+
```
6728

68-
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
69-
{
70-
static NSString *CellIdentifier = @"image_cell";
71-
UITableViewCell *cell = UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
72-
UIImageView * imageView = (UIImageView*)[cell viewWithTag:1];
73-
74-
[imageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%i.png",indexPath.row]]];
75-
imageView.contentMode = UIViewContentModeScaleAspectFill;
76-
[imageView setupImageViewer];
77-
imageView.clipsToBounds = YES;
78-
return cell;
79-
}
29+
```swift
30+
import MHFacebookImageViewer
8031

81-
### If you want to include multiple images, Here is the DataSource Protocol or look for the sample project included in this repo.
82-
83-
- (NSInteger) numberImagesForImageViewer:(MHFacebookImageViewer*) imageViewer;
84-
- (NSURL*) imageURLAtIndex:(NSInteger)index imageViewer:(MHFacebookImageViewer*) imageViewer;
85-
- (UIImage*) imageDefaultAtIndex:(NSInteger)index imageViewer:(MHFacebookImageViewer*) imageViewer;
32+
let imageView = UIImageView()
33+
imageView.image = UIImage(named: 'cat1')
34+
...
35+
imageView.setupImageViewer(with: self)
36+
```
8637

87-
### That's it. :)
8838

39+
### And That's it. :)
8940

90-
Please let me know if you have any questions.
41+
Please let me know if you have any questions.
9142

92-
Cheers,
43+
Cheers,
9344
[Michael Henry Pantaleon](http://www.iamkel.net)
9445

9546
Twitter: [@michaelhenry119](https://twitter.com/michaelhenry119)

images/demo-v3.gif

6.75 MB
Loading

0 commit comments

Comments
 (0)