Giter Site home page Giter Site logo

wtoast's People

Contributors

narmo avatar parametr 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wtoast's Issues

Hide Toast manually

Is there a way to hide toast manually by calling a method or something. My toast duration is 10 seconds but if screen is changed or button is clicked, toast should dismiss.

Requirements

What version of ios is required to build this stuff?

Modifications for iOS 6 (minor) plus added tap support

I am new to iOS development and also to GitHub so apologies if I am doing all this wrong.
Thank you. I found this project very helpful.

iOS6 / Depreciation Warnings
Just wanted to point out a couple of minor changes that I needed for iOS 6 because of depreciation warnings:

Inside method __createWithText in file WToast.m

// UITextAlignmentCenter depreciated
textLabel.textAlignment = NSTextAlignmentCenter;                   

// UILineBreakModeWordWrap depreciated
textLabel.lineBreakMode = NSLineBreakByWordWrapping;    

Tapping a toast performing an action
I also wanted to share a useful addition: performing an action when a toast is tapped

In file WToast.h I declared in the interface block:

     +(void)tappedToast:(UIGestureRecognizer*)recognizer;

And in file WToast.m I implemented:

     +(void)tappedToast:(UIGestureRecognizer*)recognizer
     {
         // Only respond if we're in the ended state (similar to touchupinside)
         if( [recognizer state] == UIGestureRecognizerStateEnded )
         {
             // the label that was tapped
             //UILabel* label = (UILabel*)[recognizer view];

             // DO SOMETHING HERE
         }
     }

Finally I added the following code to your methods __createWithText and __createWithImage to link the tappedToast method to the tap gesture.

     UITapGestureRecognizer* tap = 
              [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(**tappedToast**:)];

     [toast setUserInteractionEnabled:YES];
     [toast addGestureRecognizer:tap];

Hope this is helpful to someone.

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.