brite-apps / wtoast Goto Github PK
View Code? Open in Web Editor NEWInfo messages for iOS inspired by Android Toast object
License: The Unlicense
Info messages for iOS inspired by Android Toast object
License: The Unlicense
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.
mainsrcreen is portriat, then the show toast's viewcontroller ,which is landscape;now the toast will show wrong.
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.
What version of ios is required to build this stuff?
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.