GithubHelp home page GithubHelp logo

agphotobrowser's Introduction

No Maintenance Intended

AGPhotoBrowser

A photo browser for iOS6 and iOS7 inspired by Facebook iOS app.

Demo project included.

It currently supports:

  • Any number of images through a data source
  • Optional title and description (with support for long description through a 'See more' button)
  • Full screen view
  • Pinch to zoom in/out
  • Double tap to zoom in/out
  • Orientation changes
  • "Swipe up/down" to hide the photo browser
  • "Done/Action buttons" to dismiss the browser or perform a few operations on the selected image

Install

The suggested way to install the component is using CocoaPods, just include the following line in your Podfile to get the latest version: pod "AGPhotoBrowser"

Usage

There is a demo project included that shows how to use the photo browser.

  • import AGPhotoBrowserView.h in your class
  • create a new instance of AGPhotoBrowserView and set the delegate and the dataSource to your class
  • implement - (NSInteger)numberOfPhotosForPhotoBrowser:(AGPhotoBrowserView *)photoBrowser and - (UIImage *)photoBrowser:(AGPhotoBrowserView *)photoBrowser imageAtIndex:(NSInteger)index methods from the datasource
  • (optional) provide a title and a description for each image implementing - (NSString *)photoBrowser:(AGPhotoBrowserView *)photoBrowser titleForImageAtIndex:(NSInteger)index and - (NSString *)photoBrowser:(AGPhotoBrowserView *)photoBrowser descriptionForImageAtIndex:(NSInteger)index
  • show the browser calling the - (void)show or - (void)showFromIndex:(NSInteger)initialIndex methods
  • dismiss the photo browser with a completion block calling - (void)hideWithCompletion:( void (^) (BOOL finished) )completionBlock

TO-DO

  • add pinch to zoom gesture on images (from 1.0.4, thanks @dtsolis)
  • support orientation changes (from 1.0.6)

agphotobrowser's People

Contributors

albertodebortoli avatar andreagiavatto avatar bitdeli-chef avatar dtsolis avatar mdewolfe avatar netoxico avatar sferrini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agphotobrowser's Issues

images not displaying with iOS 8

If you comment out [self setNeedsUpdateConstraints] in AGPhotoBrowserCell.m the images are displayed. But [statusBarDidChangeFrame] has a problem.

Reading the UIImages from NSURLS

Hi, thanks for the amazing work!
I have faced this one issue. I want to pass NSURLS to the class and cache the images from a website.

  • (UIImage *)photoBrowser:(AGPhotoBrowserView *)photoBrowser imageAtIndex:(NSInteger)index
    {
    __block UIImage *image;

    NSURL *url = [NSURL URLWithString:[photoArray objectAtIndex:index]];

    [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:url] queue:[NSOperationQueue mainQueue]
    completionHandler:^(NSURLResponse *_response, NSData *_data, NSError *_error) {

    image = [UIImage imageWithData:_data];

    }];

    return image;
    }
    Now the problem is that the block takes a long time to complete while the return image is reached earlier. Have you done anything about this issue?

Problem using with UIActionSheet

I create UIActionSheet before display AGPhotoBrowser. In delegate of UIActionSheet When I click display AGPhotoBrowser display the image but suddenly close its view. How can I resolve this?

I only change these lines of codes of depo project.

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) {
[self.browserView showFromIndex:0];
}

}

  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Seç" delegate:self cancelButtonTitle:@"Vazgeç" destructiveButtonTitle:nil otherButtonTitles:@"Seç", @"Meç", nil];
    [actionSheet showInView:self.view.window];

}

Title and Description Take Two

Related #2, but with more detail.

The description is displayed at the top of the screen until the swipes left or right, then it is displayed at the bottom.

Before swipe:

ios_screen

After:

ios_screen_2

The docs imply the UI should be consistent since there is not mention of this. Any known workaround or up coming fix?

Done via:

- (NSString*) photoBrowser:(AGPhotoBrowserView *)photoBrowser descriptionForImageAtIndex:(NSInteger)index {
    return self.selectedTweet.textTweet;
}

enhancement: select images.

{not sure if this is ok to post this way.. kinda new to git..}

This is a nice looking project, and its' utility would double if we could use it to call up with a source of photos to enable the user to select images, then return control to the app code for processing. I know there are UIImagePickers out there.. just looking for a bit of pizazz..

Double tap on the black area around photo in the view behaves weird

When the view is presented and centred I try to double tap on the black area but close to the actual photo. As a result the view is zoomed the photo gets moved either up or down (depending where double tapped); when I try to move the photo back the gesture closes the view (dismisses). Expected behaviour: double tap zooms the photo and centres it.

Rotation support

This is the nicest photo gallery I've seen so far.
It lacks only orientation change support.

Images at bottom of view when device is flat.

For some reason when I load the photo browser and my device is laying flat on a table the images will show up at the bottom of the view and the title and description will be chopped off. If I tilt the device towards me, so it is more vertical, the images center.

Just thought I'd post this to see if anyone else can replicate.

How to open UIActivityView for share

Any idea about opening a UIActivityView for the sharing purpose.
As the BrowserView takes the full screen and it does not let any other view to come at front.
Help will be great :)

OverlayView problems with title and description

When I open browserView, it opens correctly but had some problem with description and title, which get aligned to top. When I rotate the view and turn it back to portrait the overlayView corrects itself and moves there where should be. I fixed this by adding this line [self.overlayView resetOverlayView]; on setupView (AGPhotoBrowserView). Please find another fix or add this line to it

"Show More" button moves after touching

Running the iPhone 5, iOS 7 simulator, by repeatedly tapping the "Show More" button on a long description image, I am able to cause the following to happen. It seems there is just an error calculating for state.

Show More example

Broken in iOS 11

This project is broken and doesn't work anymore in iOS 11.
I have been using this control in all my apps but once I upgraded to Xcode 9 and run it in iphone 8 simulator running iOS 11 it just doesn't work anymore. No browserView comes up.

Please help!

When a photo has been zoomed, the gesture recognizer should not respond to swipe up or down to dismiss.

If drag to left or right at the begining, then continue drag to up or down works fine.
But if drag to up or down at the begining it respond to dismiss action.
I think the reason we zoom a photo is for drag it to any orientation,
and at that specific case we still have a done button do the dismiss action

And landscape photo zooms weird, there is too much black background.
I think it's the height of the scrollView it too high.

//----------
Sorry for my poor English.

images not displaying with iOS 8 GM

The AGPhotoBrowser.xcodproject is not displaying images when selected.

I have been testing my app for iOS 8 and experienced a problem where images were not displaying. I cache images in an NSDictionary after they are loaded. The image displays when loaded from the network, but is not displayed when loaded from the NSDictionary Cache. After much research I installed the AGPhotoBrowser app on an iPad mini to test and images are not displayed when selected from the viewcontroller.

This leads me to believe that my problem is with AGPhotoBrowser.

Has any testing been done with xCode 6 and iOS 8. I experienced the problem in beta 6 and GM.

Title / description

The Title and Description is only shown after i swipe/move the image left / right ...

import Image in Browser

how to use NSURL array to get the image for

  • (UIImage *)photoBrowser:(AGPhotoBrowserView *)photoBrowser imageAtIndex:(NSInteger)index
    method?
    and can help me to preload Image from URL?

I tried use
NSArray *array = @[@"http://imgur.com/0001.png", @"http://imgur.com/0002.png", @"http://imgur.com/0003.png"]

  • (UIImage *)photoBrowser:(AGPhotoBrowserView *)photoBrowser imageAtIndex:(NSInteger)index{
    return [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[array objectAtIndex:index]]];
    }
    but it's too slow to browse the photos. how to fix that problem?
    thanks for your helping.

OverlayView not getting set properly on intial [_photoBrowser show]

I'm having an issue with the image overlay view not getting set properly when the browser view is initially shown. The title and description show up in the upper left hand corner and are all mangled.

I found that if I call [self.overlayView resetOverlayView] in the show function within AGPhotoBrowserView it fixes the problem.

In IOS7.04 the Background alpha animation will couse crash (not Usually)

in AGPhotoBrowserView

// [UIView animateWithDuration:AGPhotoBrowserAnimationDuration //0.25
// animations:^(){
// self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:1.];
// }
// completion:^(BOOL finished){
// if (finished) {
// self.userInteractionEnabled = YES;
// self.displayingDetailedView = YES;
// self.photoTableView.alpha = 1.;
// [self.photoTableView reloadData];
// }
// }];

UIActivityViewController

What is the correct way to present a UIActivityViewController in didTapOnActionButton ?

thanks

Photo zoomed then rotate causes weird effects eventually shrinking image

If you are viewing an image and Rotate back and forth between orientations everything is ok.

But if you zoom into an image then Rotate back and forth between orientations the image gets resized over and over and is off to one side of the screen.

I am using iOS 7 and the latest version. I am also getting warnings for '/AGPhotoBrowser-master/src/AGPhotoBrowserOverlayView.m:77:67: 'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:'

Any ideas on how to fix this effect?
Thank you for a great control.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.