Skip to content

Commit eac3012

Browse files
committed
Added video support
Also added @3x images for all images
1 parent 5f325a2 commit eac3012

File tree

86 files changed

+2457
-2045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2457
-2045
lines changed

Assets/[email protected]

32.8 KB

Assets/[email protected]

114 KB

Assets/ImageSelectedSmallOff.psd

31.2 KB

Assets/[email protected]

38.3 KB

Assets/[email protected]

47.3 KB

Assets/ImageSelectedSmallOn.psd

-1.29 KB

Assets/[email protected]

-1.32 KB

Assets/[email protected]

48.5 KB

Assets/PlayButtonOverlayLarge.psd

38 KB

Assets/[email protected]

53.5 KB

Assets/[email protected]

66 KB

Assets/PlayButtonOverlayLargeTap.psd

38.8 KB

Assets/[email protected]

53.3 KB

Assets/[email protected]

66 KB

Assets/SelectedButton.psd

-50.3 KB
Binary file not shown.

Assets/[email protected]

-72.6 KB
Binary file not shown.

Assets/[email protected]

114 KB

Assets/[email protected]

28.8 KB

Assets/VideoOverlay.psd

28.3 KB

Assets/[email protected]

30.3 KB

Assets/[email protected]

31.5 KB

Example/MWPhotoBrowser.xcodeproj/project.pbxproj

+76-67
Large diffs are not rendered by default.
5.26 MB
Binary file not shown.

Example/MWPhotoBrowser/MWPhotoBrowser-Info.plist

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>UIViewControllerBasedStatusBarAppearance</key>
6-
<true/>
75
<key>CFBundleDevelopmentRegion</key>
86
<string>en</string>
97
<key>CFBundleDisplayName</key>
@@ -32,6 +30,8 @@
3230
<array>
3331
<string>armv7</string>
3432
</array>
33+
<key>UIStatusBarHidden</key>
34+
<true/>
3535
<key>UISupportedInterfaceOrientations</key>
3636
<array>
3737
<string>UIInterfaceOrientationPortrait</string>
@@ -45,5 +45,7 @@
4545
<string>UIInterfaceOrientationLandscapeLeft</string>
4646
<string>UIInterfaceOrientationLandscapeRight</string>
4747
</array>
48+
<key>UIViewControllerBasedStatusBarAppearance</key>
49+
<true/>
4850
</dict>
4951
</plist>

Example/MWPhotoBrowser/Menu.m

+55-10
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
8585
}
8686

8787
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
88-
NSInteger rows = 7;
88+
NSInteger rows = 8;
8989
@synchronized(_assets) {
9090
if (_assets.count) rows++;
9191
}
@@ -110,7 +110,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
110110
break;
111111
}
112112
case 1: {
113-
cell.textLabel.text = @"Multiple photos";
113+
cell.textLabel.text = @"Multiple photos and video";
114114
cell.detailTextLabel.text = @"with captions";
115115
break;
116116
}
@@ -134,14 +134,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
134134
cell.detailTextLabel.text = @"photos from web";
135135
break;
136136
}
137-
case 6: {
137+
case 6: {
138138
cell.textLabel.text = @"Web photo grid";
139139
cell.detailTextLabel.text = @"showing grid first";
140140
break;
141141
}
142-
case 7: {
143-
cell.textLabel.text = @"Library photos";
144-
cell.detailTextLabel.text = @"photos from device library";
142+
case 7: {
143+
cell.textLabel.text = @"Web videos";
144+
cell.detailTextLabel.text = @"showing grid first";
145+
break;
146+
}
147+
case 8: {
148+
cell.textLabel.text = @"Library photos and videos";
149+
cell.detailTextLabel.text = @"media from device library";
145150
break;
146151
}
147152
default: break;
@@ -158,7 +163,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
158163
// Browser
159164
NSMutableArray *photos = [[NSMutableArray alloc] init];
160165
NSMutableArray *thumbs = [[NSMutableArray alloc] init];
161-
MWPhoto *photo;
166+
MWPhoto *photo, *thumb;
162167
BOOL displayActionButton = YES;
163168
BOOL displaySelectionButtons = NO;
164169
BOOL displayNavArrows = NO;
@@ -174,7 +179,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
174179
enableGrid = NO;
175180
break;
176181
case 1: {
177-
// Photos
182+
// Local Photos and Videos
178183
photo = [MWPhoto photoWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"photo5" ofType:@"jpg"]]];
179184
photo.caption = @"Fireworks";
180185
[photos addObject:photo];
@@ -183,7 +188,11 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
183188
[photos addObject:photo];
184189
photo = [MWPhoto photoWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"photo3" ofType:@"jpg"]]];
185190
photo.caption = @"York Floods";
186-
[photos addObject:photo];
191+
[photos addObject:photo];
192+
photo = [MWPhoto photoWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video_thumb" ofType:@"jpg"]]];
193+
photo.videoURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"]];
194+
photo.caption = @"Big Buck Bunny";
195+
[photos addObject:photo];
187196
photo = [MWPhoto photoWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"photo4" ofType:@"jpg"]]];
188197
photo.caption = @"Campervan";
189198
[photos addObject:photo];
@@ -1015,6 +1024,42 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
10151024
startOnGrid = YES;
10161025
break;
10171026
case 7: {
1027+
1028+
// Videos
1029+
1030+
photo = [MWPhoto photoWithURL:[[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/e15/11192696_824079697688618_1761661_n.jpg"]];
1031+
photo.videoURL = [[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xpa1/t50.2886-16/11200303_1440130956287424_1714699187_n.mp4"];
1032+
[photos addObject:photo];
1033+
thumb = [MWPhoto photoWithURL:[[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-15/s150x150/e15/11192696_824079697688618_1761661_n.jpg"]];
1034+
thumb.isVideo = YES;
1035+
[thumbs addObject:thumb];
1036+
1037+
// Test video with no poster frame
1038+
// photo = [MWPhoto videoWithURL:[[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xfa1/t50.2886-16/11237510_945154435524423_2137519922_n.mp4"]];
1039+
// [photos addObject:photo];
1040+
// thumb = [MWPhoto new];
1041+
// thumb.isVideo = YES;
1042+
// [thumbs addObject:thumb];
1043+
1044+
photo = [MWPhoto photoWithURL:[[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/e15/11240463_963135443745570_1519872157_n.jpg"]];
1045+
photo.videoURL = [[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xfa1/t50.2886-16/11237510_945154435524423_2137519922_n.mp4"];
1046+
[photos addObject:photo];
1047+
thumb = [MWPhoto photoWithURL:[[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11240463_963135443745570_1519872157_n.jpg"]];
1048+
thumb.isVideo = YES;
1049+
[thumbs addObject:thumb];
1050+
1051+
photo = [MWPhoto photoWithURL:[[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/e15/11313531_1625089227727682_169403963_n.jpg"]];
1052+
photo.videoURL = [[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xfa1/t50.2886-16/11336249_1783839318509644_116225363_n.mp4"];
1053+
[photos addObject:photo];
1054+
thumb = [MWPhoto photoWithURL:[[NSURL alloc] initWithString:@"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11313531_1625089227727682_169403963_n.jpg"]];
1055+
thumb.isVideo = YES;
1056+
[thumbs addObject:thumb];
1057+
1058+
// Options
1059+
startOnGrid = YES;
1060+
break;
1061+
}
1062+
case 8: {
10181063
@synchronized(_assets) {
10191064
NSMutableArray *copy = [_assets copy];
10201065
if (NSClassFromString(@"PHAsset")) {
@@ -1196,7 +1241,7 @@ - (void)performLoadAssets {
11961241
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
11971242
PHFetchOptions *options = [PHFetchOptions new];
11981243
options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];
1199-
PHFetchResult *fetchResults = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:options];
1244+
PHFetchResult *fetchResults = [PHAsset fetchAssetsWithOptions:options];
12001245
[fetchResults enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
12011246
[_assets addObject:obj];
12021247
}];

Example/Podfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ SPEC CHECKSUMS:
3232
Expecta+Snapshots: ca15bfb57e7a0f78f86c7699c2c54ffacfa4ad2a
3333
FBSnapshotTestCase: 3dc3899168747a0319c5278f5b3445c13a6532dd
3434
MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad
35-
MWPhotoBrowser: 48930655b7f04d4394abd12a212e8892b8f79a10
35+
MWPhotoBrowser: 59b6ae4fbba44ca46f952965ba276f9ac09341dc
3636
SDWebImage: ed3095af2ff88b436426037444979b917f6c5575
3737
Specta: 9cec98310dca411f7c7ffd6943552b501622abfe
3838

Example/Pods/Local Podspecs/MWPhotoBrowser.podspec.json

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)