Giter Site home page Giter Site logo

openflow's Introduction

Follow the project's status at http://apparentlogic.com/openflow and on Twitter at @openflow


When I released my first iPhone app, Presenter, two months ago, Apple accused me of using their private iPhone CoverFlow API. After appealing to Apple & writing a blog post about my roadblock, Apple reversed their decision.

The initial release is simple, but it is also efficient and very fast, even on first generation iPhones.

The API should be easy to include in your own program. The main class, AFOpenFlowView, is a subclass of UIView.
To use this in your own project:
-Add the OpenFlow source code to your project.
-Add the QuartzCore and CoreGraphics frameworks.
-Import “AFOpenFlowView.h” & interact with it as you would a normal UIView.
-You should implement both the AFOpenFlowViewDelegate and AFOpenFlowViewDataSource protocols.

Currently, the delegate protocol is used to let your code know when the user selected a new object. The datasource protocol is called when AFOpenFlowView needs a UIImage object. This method should be *fast*. Don’t do NSURL requests or even disk access in this method. See the AFOpenFlowDemo app I provided for an example how to load images from a remote server. The datasource also needs to provide a default UIImage.

At any point, you can set UIImage’s on your AFOpenFlowView. You don’t need to wait for the datasource protocol to ask you. Your AFOpenFlowView will start displaying images as soon as you call setNumberOfImages.

This is an initial release of OpenFlow. I licensed it under the liberal MIT open source license.
Please drop me a line to let me know what you think & where you want the project to go from here.

The source code for both OpenFlow and the AFOpenFlowDemo project are currently available on Github at http://github.com/thefaj/OpenFlow. For the demo application, you will need to register for a Flickr API key and secret. If you try to compile the demo, you will quickly find the error message where your Key & Secret should be added.

Enjoy!
-Alex

openflow's People

Contributors

thefaj 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

openflow's Issues

UIbutton instead of Image

Hi,
I've integrated you OpenFlow feature in my project,
I'm trying to modify the code to have a "button" cover-flow (each button containing an image)
I tried many ways to do this but everytime I failed,
Do you know anyone who succeeded in it ? What should I do to have this feature working?

Regards.

iOS 4.2.1 on iPhone 3G

I've a bug on iPhone 3G (ot 3Gs or 4) with the iOS 4.2.1 with the setFrame method of AFItemView.m
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [6.19918e-06 nan]'

I fixe it by adding a test

  • (void)setFrame:(CGRect)newFrame {
    CGSize size = newFrame.size;
    if(isnan(size.height)||isnan(size.width)){
    newFrame = CGRectMake(newFrame.origin.x, newFrame.origin.y, 0, 0);
    }
    [super setFrame:newFrame];
    [imageView setFrame:newFrame];
    }

I don't understand the real cause of this issue but it works, so i don't commit this code now. Tell me if you want.

Hope it's help.

setFrame:

AFOpenFlowView should also override setFrame: alongside setBounds:.

How to show bigger image?

What i have to modify to show bigger image on iPad? Now iphone and ipad show the images at 225x225 px and bigger images like 500x500 break the visual effect.

iPad

Is it possible to use/port this to the iPad?

thank you!

Unable to build AFOpenFlowDemo with Xcode 4.2 ios 5

When attempting to build AFOpenFlowDemo the build fails with the following linkage error:

"Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1"

I reran the linker on the command line so I could see stderr and obtained the following results:

iMacCoreDuo 60> /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/bromo/Library/Developer/Xcode/DerivedData/AFOpenFlowDemo-ehmqnvjtudtzsubmyfpswdpjidjl/Build/Products/Debug-iphonesimulator -F/Users/bromo/Library/Developer/Xcode/DerivedData/AFOpenFlowDemo-ehmqnvjtudtzsubmyfpswdpjidjl/Build/Products/Debug-iphonesimulator -filelist /Users/bromo/Library/Developer/Xcode/DerivedData/AFOpenFlowDemo-ehmqnvjtudtzsubmyfpswdpjidjl/Build/Intermediates/AFOpenFlowDemo.build/Debug-iphonesimulator/AFOpenFlowDemo.build/Objects-normal/i386/AFOpenFlowDemo.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 /Users/bromo/Library/Developer/Xcode/DerivedData/AFOpenFlowDemo-ehmqnvjtudtzsubmyfpswdpjidjl/Build/Products/Debug-iphonesimulator/libObjectiveFlickr.a -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CFNetwork -o /Users/bromo/Library/Developer/Xcode/DerivedData/AFOpenFlowDemo-ehmqnvjtudtzsubmyfpswdpjidjl/Build/Products/Debug-iphonesimulator/AFOpenFlowDemo.app/AFOpenFlowDemo
clang: error: no such file or directory: '/Users/bromo/Library/Developer/Xcode/DerivedData/AFOpenFlowDemo-ehmqnvjtudtzsubmyfpswdpjidjl/Build/Products/Debug-iphonesimulator/libObjectiveFlickr.a

When I looked in the Products directory there were 2 directories Debug and Debug-iphonesimulator/. The Debug directory contained a libObjectiveFlickr.a built for 386 and the Debug-iphonesimulator directory was empty. Any ideas how to fix this issue?

Positioning

I would like to be able to move the covers (top, buttom, left, right) inside a view. How can this be done ?

Swipe to get other images

In my application, Iam using gestures (Swipe gestures with 2 finger touch) to get the next content, In the main content view, Iam adding AFOpenFlowView as a subview, everything is working fine, but Iam facing a problem with swiping on cover flow images, Iam able to get the touch with more than 2 finger (3 or 4 finger touch), what can I do for single finger swipe to handle the cover flow. And also Iam facing a memory issue, I think the main array which is having loaded images is not releasing.
E.g. I have 100 images, which are getting from the service, First it will get 6 images (as we set the buffer_size as 6), If we scroll to next it is adding to that main array, but it is not removing the earlier content which is eating the more memory.

iPad Implementation

I've successfully added an AFOpenFlowView as a subview of my main view using the initWithFrame method. Once I place the view where I would like it on the screen (at the bottom), however, it no longer receives any touch information or moves the covers. Any ideas what could be causing this problem? Any help would be much appreciated.

3D Touch issue

on iPhone 6S and 6S+ users are facing issue on touch of images if 3D touch is enabled. They have to tap 5-6 times to touch a image and call its delegate. Please suggest a good solution.

How to set delegate correctly by code (without xib)?

  1. I create an UIViewController instance in AppDelegate.m

  2. In viewDidLoad of the UIViewController, create an instance of AFOpenFlowView,here is the code

    AFOpenFlowView *af = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(10,20,300,400)];

    NSString *imageName;
    for (int i=0; i < 10; i++) {
    imageName = [[NSString alloc] initWithFormat:@"%d.jpg", i];
    [af setImage:[UIImage imageNamed:imageName] forIndex:i];
    [imageName release];

    }
    [af setNumberOfImages:10];

    [self.view addSubView:af];

That this point , if I run the code, Cover flow work fines except delegate method

And the problem comes, no matter use [af setViewDelegate:self] or [af setViewDelegate:(AFOpenFlowView *)self], my app will crash after switch a Cover

Any idea how should I set the delegate properly?

Thank you guys!

Want to Change Cover Image when Double Tapped by user

Hi Helper,

I want to change the image when user double tapped any center cover image. I also want to change the order or images by performing some actions by user. Please help me with the code. How can i achieve it in given code?

iPad image width

Hello,

I have my afopenflow view as a subview hooked up with interface builder. This works fine on iPhone and the image width fits the width of the screen, which is what I want. However, for some reason on the iPad, both sides of the image gets cut off and it doesn't fit the full width of the screen. So I basically just see the middle of each image. Does anyone know how to fix this?

iOS 5 - Transition became weird and rude

Hi,
It seems that Apple has made some changes related to transformations and positioning. I have discovered that when I run OpenFlow on iOS 5 device/simulatore, the transition from one cover to another became ugly and weird.

Subclassing AFItemView to be able to add subviews to openflow

I am trying to add arbitrary UIViews to an AFOpenflowView, not just images. I am doing this by creating a subclass of of AFItemView, lets call it NewAFItemView, which represents the view I want to add. I also extended AFOpenFlowVIew, call it NewAFOpenFlowView and overrode the method

  • (AFItemView *)coverForIndex:(int)coverIndex;

My overridden method, I allocate an NewAFItemView object and return it as the cover view for that index. The NewAFItemView views appear correctly in the open flow but scrolling is immediately disabled. Switching back to allocating AFItemViews works but using NewAFItemViews does not scroll.

I have not overridden any of the touch events.

Any ideas on what might be happening?

Cheers.

setNumberOfImages

I set the number of images to 2, and it worked fine... I set it to 1... and unfortunately the second one floated to the top left of the first image......

Kind of annoying.

I think the view should be removed and moved to the offscreen view array but that is not happening. Im going to try to fix the problem in my code. but was interested in your feedback.

cannot runing in xcode4.5

I opened the demo project using code 4.5, fail compiled. I wonder whether it tested before update.

Adding OpenFlow to a horizontal UIScrollView

Firstly, top marks for this open source coverflow alternative!

I have an issue when adding OpenFlowView to a horizontal scrolling UIScrollVIew.

The scrollView appears to be cancelling OpenFlow's touchesMoved method, scrolling the scrollView instead of the OpenFlowView.

I have the feeling it could be to do with iOS 3.2 on iPad.

Any ideas ideas on how to remedy this?

Cheers,

Adem

Scrolling issue

I've integrated the AFOpenFlowView into my project and works fine,
but when I stop running, and simply change the "openFlowView.frame.origin.y" value, the weird thing happened.

For example,
First, I set the frame as follows:
AFOpenFlowView *openFlowView = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(0.0, 50, self.view.frame.size.width, 200)];
everything works fine.

than I set the frame as follows:
AFOpenFlowView *openFlowView = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(0.0, 200, self.view.frame.size.width, 200)];

I can only scroll the cover in a small area which is 50 points height from top of the openFlowView.

I've tried several y value to test it, and it seems that there would be a boundary at y = 250, which I set for the first time "y = 50 and height = 200". The bottom position of the openFlowView is 50 + 200 = 250.
Only the area higher than y = 250 and lower than current openFlowView top position is scrollable.
That means, If I change the openFlowView y value larger than 250, I can't scroll it any more.

Here is my code:
startY = 50.0;
AFOpenFlowView *openFlowView = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(0.0, startY, self.view.frame.size.width, 200)];
[openFlowView setDataSource:self];
[openFlowView setViewDelegate:self];
[openFlowView setNumberOfImages:[categoryArray count]];
for (int imageIndex = 0; imageIndex < [categoryArray count]; imageIndex++)
{
UIImage *image = [UIImage imageNamed:[[categoryArray objectAtIndex:imageIndex] objectForKey:@"imageName"]];
if (image == nil)
{
image = [UIImage imageNamed:@"Placeholder"];
}
[openFlowView setImage:image forIndex:imageIndex];
}
[openFlowView setSelectedCover:([categoryArray count] / 2)];
[openFlowView centerOnSelectedCover:NO];
[self.view addSubview:openFlowView];

Open Flow as subview - positioning issue

When an AFOpenFlow view is used as a subview, the OpenFlow view is moved to the enclosing view's 0,0 coordinate regardless of where it's placed in the layout in InterfaceBuilder. This is not immediately apparent as the covers are drawn in the correct spot - however the enclosing view may be shifted up in the enclosing view. (Changing the OpenFlow views background to something other than "clear" will make this apparent.)

I noticed this when touches/swipes on the bottom of the OpenFlow view didn't register. The bottom of the covers is effectively cut off from getting the touches since the view is shifted up.

A fix that's working for me thus far involves changing the following code in the AFOpenFlowView in the setUpIntitalState method:

line 65:
self.layer.position=CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);

I converted this point into the context of the superview:

CGPoint layerRelPt = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);
self.layer.position = [self convertPoint:layerRelPt toView:self.superview];

Further testing needs to be done but so far, so good.

Added an small extra feature

Hi,
I modified your code to be able to to trigger a method when a cover is selected by the user (I mean touching it once it has already been selected).

Where can I send my code ?

Can't use properly when integrating OpenFlow strictly with code (no IB)

I am trying to add an OpenFlow view in code rather than through IB. But setUpInitialState expects self.datasource to already be set which is impossible when using the standard:
AFOpenFlowView *openFlowView = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(...)];

I can't set openFlowView.datasource = self; until after this line.

Reloading the OpenFlow

Can you provide a method for clearing AFOpenFlowView images without needing to release and re-instantiate programmatically?
e.g after you display Flicker image library and you want to search something else without closing and opening application

all images are loaded in memory

all images are loaded in memory . I think it's a huge problem when I use images over 100 count .
I think we only need load 10 images in memory, when swipe, release some images and load some images from local cache or network, not load them all in memory

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.