Giter Site home page Giter Site logo

cfmagiceventsdemo's Introduction

CFMagicEventsDemo

This trick was initially created to make an app for my children (available here for free : Incredible App - US/EN/FR version).
This allows to use your back camera as a simple button.
Technically, frames are captured from the back camera, and a simple algorithm is checking the fall of luminosity due to passage of your finger.

Sublime's custom image

###Installation

Copy CFMagicEvents.h and CFMagicEvents files into your project.

###ARC Compatibility

Just add the -fno-objc-arc compiler flag to the CFMagicEvents.m file. To do this, go to the Build Phases tab in your target settings, open the Compile Sources group, double-click CFMagicEvents.m in the list and type -fno-objc-arc into the popover.

###Frameworks

  • AVFoundation

###How to use

In AppDelegate (on didFinishLaunchingWithOptions method) :

_cfMagicEvents  = [[CFMagicEvents alloc] init];
[_cfMagicEvents startCapture];

In View(s) :

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveOnMagicEventDetected:) name:@"onMagicEventDetected" object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveOnMagicEventNotDetected:) name:@"onMagicEventNotDetected" object:nil];
}

-(void)viewWillDisappear:(BOOL)animated {
    
    [super viewWillDisappear:animated];
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}


-(void)receiveOnMagicEventDetected:(NSNotification *) notification
{
    dispatch_async(dispatch_get_main_queue(), ^{
        //YOUR CODE HERE
    });
}

-(void)receiveOnMagicEventNotDetected:(NSNotification *) notification
{
    dispatch_async(dispatch_get_main_queue(), ^{
        //YOUR CODE HERE
    });
}

##License CFMagicEvents is available under the MIT license. ENJOY !

##Contact Cédric Floury ([email protected])
Twitter : @zuckerbreizh.

cfmagiceventsdemo's People

Contributors

zuckerbreizh avatar

Watchers

John Clem avatar James Cloos avatar

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.