thiagoperes / idmphotobrowser Goto Github PK
View Code? Open in Web Editor NEWPhoto Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more
License: MIT License
Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more
License: MIT License
Hi,
When I did try use IDWPhotoBrowser on the big array of the pictures, I find the problem with scrolling picture.
On iPad or iPad-simulator scroll don’t completed.
You can see this effect on scroll pictures with array more 20000 pictures and index more 18000.
This is the sample code in the file «menu.m» for view this effect scrolling:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Create an array to store IDMPhoto objects
NSMutableArray *photos = [NSMutableArray new];
IDMPhoto *photo;
if(indexPath.section == 0) // Local photo
{
photo = [IDMPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"photo2l" ofType:@"jpg"]];
photo.caption = @"The London Eye is a giant Ferris wheel situated on the banks of the River Thames, in London, England.";
[photos addObject:photo];
}
else if(indexPath.section == 1) // Multiple photos
{
if(indexPath.row == 0) // Local Photos
{
photo = [IDMPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"photo1l" ofType:@"jpg"]];
photo.caption = @"Grotto of the Madonna";
[photos addObject:photo];
photo = [IDMPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"photo2l" ofType:@"jpg"]];
photo.caption = @"The London Eye is a giant Ferris wheel situated on the banks of the River Thames, in London, England.";
[photos addObject:photo];
photo = [IDMPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"photo3l" ofType:@"jpg"]];
photo.caption = @"York Floods";
[photos addObject:photo];
photo = [IDMPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"photo4l" ofType:@"jpg"]];
photo.caption = @"Campervan";
[photos addObject:photo];
}
else if(indexPath.row == 1 || indexPath.row == 2) // Photos from Flickr or Flickr - Custom
{
for (int i=0; i < 25000; i++) {
[photos addObject:[IDMPhoto photoWithURL:[NSURL URLWithString:@"http://farm4.static.flickr.com/3567/3523321514_371d9ac42f_b.jpg"]]];
}
}
}
// Create and setup browser
IDMPhotoBrowser *browser = [[IDMPhotoBrowser alloc] initWithPhotos:photos];
browser.delegate = self;
[browser setInitialPageIndex:20000];
if(indexPath.section == 1) // Multiple photos
{
if(indexPath.row == 1) // Photos from Flickr
{
browser.displayCounterLabel = YES;
browser.displayActionButton = NO;
}
else if(indexPath.row == 2) // Photos from Flickr - Custom
{
browser.actionButtonTitles = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4"];
browser.displayCounterLabel = YES;
browser.useWhiteBackgroundColor = YES;
browser.leftArrowImage = [UIImage imageNamed:@"IDMPhotoBrowser_customArrowLeft.png"];
browser.rightArrowImage = [UIImage imageNamed:@"IDMPhotoBrowser_customArrowRight.png"];
browser.leftArrowSelectedImage = [UIImage imageNamed:@"IDMPhotoBrowser_customArrowLeftSelected.png"];
browser.rightArrowSelectedImage = [UIImage imageNamed:@"IDMPhotoBrowser_customArrowRightSelected.png"];
browser.doneButtonImage = [UIImage imageNamed:@"IDMPhotoBrowser_customDoneButton.png"];
browser.view.tintColor = [UIColor orangeColor];
browser.progressTintColor = [UIColor orangeColor];
browser.trackTintColor = [UIColor colorWithWhite:0.8 alpha:1];
}
}
// Show
[self presentViewController:browser animated:YES completion:nil];
//[self.navigationController pushViewController:browser animated:YES];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
Do you consider to add video browse and play feature in the future release?
Would be really nice! Any chance? What are the reasons for making this framework available just for iOS 7+ ?
I want to add a couple of buttons to the topNav (where done is) is that easily achieved ? I prefer not to use the action sheet.
Although fairly minor, it seems more sustainable to use cocoapods to manage the dependencies (AFNetworking, etc) in the demo project, right?
You can simulate this error on de demo project.
1 - Choose "Photos form flick custom"
2 - Go to the last photo
3 - Rotate the device.
It shows the wrong photo.
It only happens on the last photo.
BTW thanks for this amazing control !
@appkraft What about interface orientations?
Could you add some delegate/completion block when dismiss photo browser?
When presenting the photo browser on iOS 7, if you do not specify a view to animate from, there is no animation. The view controller appears without a transition.
Would this project be open to supporting SDWebImage as the image cache and download engine, in addition to AFNetworking? Essentially, you could support both by breaking the URL loading and caching code into a category of IDMPhoto. Then, use cocoapods subspecs to allow developers to choose between SDWebImage and AFNetworking when installing the IDMPhotoBrowser pod. In fact, this strategy could be extended Here's what it would look like:
Install with AFNetworking:
pod 'IDMPhotoBrowser/Core'
pod 'IDMPhotoBrowser/AFNetworking ' # This adds IDMPhoto+AFNetworking
OR
Install with SDWebImage:
pod 'IDMPhotoBrowser/Core'
pod 'IDMPhotoBrowser/SDWebImage' # This adds IDMPhoto+SDWebImage
Both categories on IDMPhoto
would have the same networking methods (+ (IDMPhoto *)photoWithURL:(NSURL *)url;
), just different implementations.
Dear team, i have a problem with Gif image, when i use
NSArray *photos = [IDMPhoto photosWithURLs:imageArr];
imageArr include GIF image link , but when IDMPhoto show , image gif display only 1 frame. How i do to fix this?
Many thanks!
../Pods/IDMPhotoBrowser/Classes/IDMPhoto.m:150:42: Incompatible block pointer types sending 'void (^)(NSUInteger, NSInteger, NSInteger)' to parameter of type 'void (^)(NSUInteger, long long, long long)'
The cocoapods file should always be updated to the latest release tag.
Hello
on IDMZoomingScrollView.m
method - (void)handleSingleTap:(CGPoint)touchPoint
its a warning about an undeclared selector 'toggleControls'
solution:
add the following line
nothing major. just wanted to let you know!
Keep up the excellent work
thanks
when i add video link its not playing. if there is no video playing option enable please add that option
If device doesn't have an e-mail configured, the gallery will show possibility of e-mail send. And after 'Email' option tapped application crash. Before create ActionSheet you should check it.
I've added to demo project(menu.m):
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
When I open photo and turn the device, it only changes the orientation of the IDMPhotoBrowser interface. The root view does not change orientation. How can I fix it(for example, your demo project)?
When adding to fresh app via cocoapods, the build fails with the following output:
Undefined symbols for architecture i386:
"OBJC_CLASS$_MFMailComposeViewController", referenced from:
objc-class-ref in libPods.a(IDMPhotoBrowser.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hello,
I love your work, just a feature request, do you plan to implement the grid of thumbnails (just like in MWPhotoBrowser)?
Thanks
Both toolbars on the top and the bottom disappear if I swipe to go back and forth. if I use the arrows, it doesn't happen.
Is there a way to disable the automatically hiding of the toolbars when swiping?
Has this been dropped? The podspec for 1.3.2 ˙as 7.0 as platform
Hi,
Thanks for the excellent work.
I found a "retain cycle".
IDMZoomingScrollView -> IDMPhoto -> IDMProgressUpdateBlock -> IDMZoomingScrollView
- (void)configurePage:(IDMZoomingScrollView *)page forIndex:(NSUInteger)index {
page.frame = [self frameForPageAtIndex:index];
page.tag = PAGE_INDEX_TAG_OFFSET + index;
page.photo = [self photoAtIndex:index];
__block __weak IDMPhoto *photo = (IDMPhoto*)page.photo;
photo.progressUpdateBlock = ^(CGFloat progress){
[page setProgress:progress forPhoto:photo];
};
}
Should use a '__weak' ref for page involved in the block above, or break the cycle in method unloadUnderlyingImage
.
Using the browser in iOS 7 and presenting it through navigation controller causes the first image to appear clipped to the top region. Also the image can be scrolled to top and bottom.
But flipping to the next image removes the problem, How ever the images can be scrolled in all directions, can it get fiexed. Please concentrate on iOS 7 coz i need to update my app.
Is there a way to keep the zoom on rotation?
Also is there a way to change the animation effect when rotating?
Thank you
rt, could you please use the AFNetworking 1.x ?
cause many app want to deploy to 6.0
Hi, I'm using newest AFNetworking 2.0 in my iOS 7 project, and I would also like to use IDMPhotoBrowser, since I've got great experience with it. Unfortunately I can't - cocoapods says that it needs AFNetworking 1.3.1. Can I do something about it, or it needs to be fixed and updated?
Nice control, thanks!
We show our browser like this:
IDMPhotoBrowser *browser = [[IDMPhotoBrowser alloc] initWithPhotos:photosArray];
[self presentViewController:browser animated:YES completion:nil];
But then when tapping done we get UIApplicationInvalidInterfaceOrientation
.
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!'
*** First throw call stack:
(
0 CoreFoundation 0x0273a5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x024bd8b6 objc_exception_throw + 44
2 CoreFoundation 0x0273a3bb +[NSException raise:format:] + 139
3 UIKit 0x013535ac -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] + 580
4 UIKit 0x015d76e5 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:] + 2330
This is in iOS7. App setup to configure portrait and landscape. Any help appreciated.
Tobin
Hello
i experienced a crash right when the user taps on a cell image, the modal opens and the progress is being shown to download an image from the web.
if you do not wait for the whole image to download and hit the DONE button the method performCloseAnimationWithScrollView crashes when setting the resizableImageView frame size, since the imageFromView is nil.
a solution would be an if statement like this:
if (imageFromView == nil) {
// in case the user taps the DONE button without
// waiting for the whole image to download
resizableImageView.frame = CGRectZero;
}
else{
.......
if you find any better solution please share.
thanks
NSInteger .currentPageIndex property would be nice to know for example when
If you look at the demo project on iOS 7, when you click on a photo, in the second while the photo is animating to be presented, you can see the status bar disappear and the navigation bar and the entire contents of the view visibly shift upwards (not animated or sliding, but abruptly jumps) by the size of the status bar.
After dismissing the photo browser, you can also see the status bar appearing, sliding everything down, although this seems to be in some kind of animation.
Is there a way to get rid of this shifting?
I found that I had to set:
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
to get the black background to fade away properly. Just a tip if anyone else has this problem. Solution found here: http://stackoverflow.com/questions/12736394/uimodalpresentationcurrentcontext-with-transition
Hi! Is there a way to disable the swipe up/down to dismiss the photo browser? I checked the header file but didn't come across any property or anything.
Hey man,
Im probably doing something wrong here, but I'm getting 3 Linker errors on my project.
I imported all the classes to my project and tried to make a simple displayer, made the
Ill attach some images that might help you in helping me :)
Thanks very much.
as I integrate it in my project, with large image (about 2500x1600). It doesn't release memory when I close it. How do I resolve this?
I seems that when swipe up/down to dismiss the view controller it works fine for the first time, but it can not reveal the background view for the next time. I store the browser in a property for reuse.
Hello.
First of all thanks for the great library. Excellent work.
in the - (void)doneButtonPressed:(id)sender method
you call performCloseAnimationWithScrollView
which on the animation completion handler it calls the same method, doneButtonPressed, again with a nil sender.
this causes the following warning:
Warning: Attempt to dismiss from view controller <UINavigationController: ......> while a presentation or dismiss is in progress!
in order to fix this you can add this:
if ([self isBeingDismissed]) {
return;
}
on top of the - (void)doneButtonPressed:(id)sender method
before anything else. this way it will not try to dismiss the controller a second time.
if someone has a better solution for this please let us know
thanks
please, make normal rotation support in your photo browser.
it seems that window does not have rotation support, but it is widely used in your project.
i want to be able to delete a photo from the current visible gallery. a second approach could be dismissing the gallery manually and delete then the photo from the datasource array provided for the gallery initialization.
are any of these features somehow feasible?
regards
markus
hi,
i know that your are working for iOS7 support.
when do u deal with rotation, consider that there is a bug if you use IDM with UITabBarController.
here is the bug:
-all the tabs runs just in Portrait mode. (shouldautorotate=NO)
-open the IDM photo browser as Modal.
-rotate to landscape.
-close the IDM
-you will see that Status bar is still LandscapeMode.
-then if you open MoviePlayerController, it runs in landscape mode. after closing the movie player (status bar's old value is Landspace), it automatically rotates the tab bar to landscape.
-As 'shouldautorotate' is NO , its impossible to rotate to portrait.
thanks…
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.