gdavis / fgallery-iphone Goto Github PK
View Code? Open in Web Editor NEWObjective-C based gallery for iPhones
Objective-C based gallery for iPhones
I'm trying to use segues and storyboards with the FGalleryViewController and i think I'm missing something
I have my TableViewController (which implements and the methods)connected to a View Controller which I've changed to the type FGalleryViewController in the Story Board, and in the
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self performSegueWithIdentifier:@"ShowGallery" sender:self];
}
Then, in my prepareForSegue, I have the following
if ([segue.identifier isEqualToString:@"ShowGallery"]) {
FGalleryViewController *controller = (FGalleryViewController *) segue.destinationViewController;
controller.photoSource=sender;
}
The problem is there's no way to do the "initWithPhotosouce" so I'm setting the photosource after the fact.
Everything seems to work, except that the photos arent showing up.. just black. I'm using the default network images in the example and I debugged so I know they exist and are being set right.
am I missing something?
i tried a lot but FGallery load images blank in both thumbnail and full-size view in iPhone.
After downloading the zipball and running the example, i felt it would be better-looking to have animation too when pressing next and previous buttons, so i went into ´(void)next´ and {(void)previous´ and set the animated flag to ´YES´ on the ´gotoImageByIndex´ call.
If you then load the local images demo and START moving with the next button until the end, you'll notice that the last image is not loaded. I fixed this by removing the ´if( !animated )´ check on ´gotoImageByIndex´, but maybe it breaks something else, haven't checked yet.
Thanks for the great work!
In
FGalleryViewController.m
the autorotation-methods for its parent controller have been overridden, which has worked wonderful until the recent release of iOS6.
Unfortunately, the images can no longer be rotated when the supported rotations have been set to, for example, only portrait. It seems like the method does not override this behavior anymore.
Did someone came up with a solution for this?
Is there a reason why the control doesn't rotate when the device is turned upside down?
The FGallery categories for UINavigationController and UITabBarController contain a shouldAutorotateToInterfaceOrientation: method.
This is terribly wrong. It took me hours to debug this.
The issue here is that when you import the gallery module sources and have -all_load linker flag this overrides the default behaviour of the nav bar controller and tab bar controller and the shouldAutorotateToInterfaceOrientation: event of the view controllers doesn't get called, the category one overrides it.
If you want to always rotate the gallery screen you should delegate that responsibility to the developer who uses the library.
Kinds regards,
Ivan.
Hey there
I ended up forking the project to add in the initWithCoder and externalize the _barItems in FGalleryViewController.
https://github.com/jmattos/FGallery-iPhone
Hope that helps ! :)
iOS7, 3.5inch simualtor.
Single tap on the image switches to fullscreen, but the image position jumps. Tapping again to exit fullscreen causes it to jump again.
Compare this behavior to the native photo gallery app.
Hello,
I have a problem since the transition to IOS7, when I click the image I receive the following error:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
I do not get this error when I test my application with IOS6.1.
Everything works correctly in IOS6.1.
Thanks for your help.
Is there a way to set the image index before displaying the gallery?
Occasionally the FGalleryViewController will add additional left and right arrows into the toolbar each time the view controller is navigated back to ([[self navigationController] popViewControllerAnimated:YES];)
I have looked at the code where the left and right arrows are loading into the view and it does not make sense because the loadView method is not called when the popViewControllerAnimated is called. I have also added:
if([[_toolbar items] count] == 0)
{
UIImage *leftIcon = [UIImage imageNamed:@"photo-gallery-left.png"];
UIImage *rightIcon = [UIImage imageNamed:@"photo-gallery-right.png"];
_nextButton = [[UIBarButtonItem alloc] initWithImage:rightIcon style:UIBarButtonItemStylePlain target:self action:@selector(next)];
_prevButton = [[UIBarButtonItem alloc] initWithImage:leftIcon style:UIBarButtonItemStylePlain target:self action:@selector(previous)];
// add prev next to front of the array
[_barItems insertObject:_nextButton atIndex:0];
[_barItems insertObject:_prevButton atIndex:0];
_prevNextButtonSize = leftIcon.size.width;
// set buttons on the toolbar.
[_toolbar setItems:_barItems animated:NO];
}
which should make certain that only the 2 arrow buttons get added, this also does not fix the issue. Any ideas?
sometimes when I goto one of the galleries (I adapted for 7 local categories) the top row of pictures are offset up by about 30 pixels.
having trouble figuring out where and how to tell the thumbsview scroll to scroll to top.
i am facing orientation issue with iOS8. Please let me know solution ASAP.
NSMutableArray *fullPathImageArray=[[NSMutableArray alloc]init];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
filePathsArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectory error:NULL];
filePathsArray = [filePathsArray filteredArrayUsingPredicate:
[NSPredicate predicateWithFormat:@"pathExtension ==[c] %@", @"jpg"]];
for (int i=0; i<[filePathsArray count]; i++)
{
NSString* fullPathToFile = [documentsDirectory stringByAppendingPathComponent: [filePathsArray objectAtIndex:i]];
[fullPathImageArray insertObject:fullPathToFile atIndex:i];
}
When fullPathImageArray is used as PhotoSourceTypeLocal nothing is displayed in the gallery.
Does anybody have a FGallery project working with ARC? :)
(not -fno-objc-arc flag for files)
Hi thereI was wondering why you chose to override rotation in the FGalleryViewController. The comment is
/**
Just curious.
Analyze code with llvm analyzer. It founds many Dead Store Errors.
Hey there,
FGallery seems to have a few issues with iOS 7. As release date of iOS 7 seems to come closer (if you watch the change logs of previous beta releases), I would like to know if there are plans to migrate FGallery to iOS 7.
Issues I found so far:
Hi,
I have faced an issue in scrolling images when we scroll very fast and scroll view offset becomes -ve, i that case app will crash
Can you please check the code?
I have fixed that in below method
by adding
if(_scroller.contentOffset.x < 0)
return;
(void)scrollingHasEnded {
_isScrolling = NO;
if(_scroller.contentOffset.x < 0)
return;
NSUInteger newIndex = floor( _scroller.contentOffset.x / _scroller.frame.size.width );
// don't proceed if the user has been scrolling, but didn't really go anywhere.
if( newIndex == _currentIndex )
return;
// clear previous
[self unloadFullsizeImageWithIndex:_currentIndex];
_currentIndex = newIndex;
[self updateCaption];
[self updateTitle];
[self updateButtons];
[self loadFullsizeImageWithIndex:_currentIndex];
[self preloadThumbnailImages];
}
If its fine then please update the code so that in future if anyone use this then should not face this issue.
Thanks
not support for rotation
in iOS6 ,FGallery work perfect,
but in iOS7 beta,when app start to present FGalleryVC to show images,if user click back btn ,app crash.
Hi there
Sorry for the silly question, how do I set the size of the screen for FGallery ?
I need to restrict the are 'couse I have a custom nav bar in the top.
Any help ?
Tnx
Roberto
function layoutViews
is not calling from the function - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
I try to call layoutViews
method in the willRotateToInterfaceOrientation
delegate but in this case design becime distorted.
I was just trying to demo the v2.0 branch and found that the project.pbxproj file was removed in commit 73447ae. Xcode can't open the project unless this file is present.
Would be good to have a consistent way to customize initial state of the library, with ability to start in both photo & thumbnail views (hiding the button in thumbnail view would be cool as well :). Not as hard to workaround these, but would be nice to have support for these kind of things directly within the library.
Using the removeImageAtIndex: method, it removes the image but doesn't update the photo view properly. It just presents a black background - if you then thumb left or right the image indexing seems all messed up (wrong photos come up, doesn't show some). I'm only testing with between five to ten images and only in fullscreen, not using thumbnails at all. I'm loading all images from the files system.
Took a look at the method implementation for removeImageAtIndex and I don't see it doing anything to adjust or check _currentIndex (against the [_photoSource numberOfPhotosForPhotoGallery:self] upper boundary. Also the moveScrollerToCurrentIndexWithAnimation: call from layoutViews: is using the _currentIndex but I couldn't figure out exactly what it was doing with the scroller frame calculations.
Following code is working but there is no NavigationBar
promoGallery* gallery = [[promoGallery alloc] init];
gallery.imageArray = self.fullImageArray;
FGalleryViewController* pVC = [[FGalleryViewController alloc] initWithPhotoSource:gallery];
pVC.currentIndex = btn.tag;
[self presentModalViewController:pVC animated:YES];
So, I put navigation controller like below and it crash
promoGallery* gallery = [[promoGallery alloc] init];
gallery.imageArray = self.fullImageArray;
FGalleryViewController* pVC = [[FGalleryViewController alloc] initWithPhotoSource:gallery];
pVC.currentIndex = btn.tag;
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:pVC];
[self presentModalViewController:navController animated:YES];
I check the code and it's problem in
- (void)updateScrollSize
{
float contentWidth = _scroller.frame.size.width * [_photoSource numberOfPhotosForPhotoGallery:self];
[_scroller setContentSize:CGSizeMake(contentWidth, _scroller.frame.size.height)];
}
there is no _photoSource after init with UINavigationBar
Hi, im a real newbie, and don't know how to override plist and allow this to rotate, whilst all other views not rotating. Can anyone give me some help, i can't seem to get it working. Many thanks.
Hello Sir,
Please include the audio files listening facility to your project .
I have tried to do that , but got the many errors . You can look at question at http://stackoverflow.com/questions/17483857/modifying-fgallery-library-to-include-audio-files-also
please help ...
It looks like on some occasions the caption height will not be calculated properly. A simpler and safer way to calculate the size of the caption is to use [_caption sizeThatFits...]
in update caption I use this and all works fine:
float captionWidth = _container.frame.size.width-kCaptionPadding*2;
_caption.numberOfLines = 0;
_caption.text = caption;
CGSize adjustedSize = [_caption sizeThatFits:CGSizeMake(captionWidth, _container.frame.size.height)];
NSInteger containerHeight = adjustedSize.height+kCaptionPadding*2;
_captionContainer.frame = CGRectMake(0, -containerHeight, _container.frame.size.width, containerHeight );
_caption.frame = CGRectMake(kCaptionPadding, kCaptionPadding, captionWidth, adjustedSize.height );
// show caption bar
_captionContainer.hidden = NO;
Is there a proper way to start in thumbnail view? Instead of the default view and then pressing show all.
Using the library with a translucent navbar leads to incorrectly arranged images in the thumbnail view. Seems to be a problem in - (void)arrangeThumbs", perhaps smth like "float dy = self.navigationController.navigationBar.bounds.size.height" might make it behave a bit better (does not fully resolve the issue though).
Hi,
I see that the gallery's supported autorotating quite well. But I failed to implement this for the Root View Controller. Can you give me some help?
Thanks in advance!
So, I loaded 180 images (about 500Kb each). And after I viewed about 15 app crashed (: Memory level is not normal (63%).).
I guess the memory handling is not done in a right way.
Hello,
I've been trying tou use FGallery (nice lib, btw) with some jpegs from my local app Documents directory, but no cigar.
Photo source array includes all paths for images, but they just don't show up, when i'm pushing the gallery in the stack.
Any suggestions on how to make it work with local Documents folder?
Cheers!
Pawel
Is this possible todo? Not an Obj-c kinda guy, how hard would this be?
Hey there again
I have the FGallery on a tab somewhat working and I've created a repository for it at https://github.com/jmattos/GalleryOnATab. The only problem is that I dont know how to prevent the gallery from taking over the whole screen, I'd obviously like it to know that it lives on a tab and take up everything but the (49 pixels?) for the tab.
Take a look and let me know what you think!
...or [_photoViews count] == 0) equals trouble :)
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.