UIView+Toast.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /***************************************************************************
  2. UIView+Toast.h
  3. Toast
  4. // JasonDevelop 2014 Charles Scalesse.
  5. Permission is hereby granted, free of charge, to any person obtaining a
  6. copy of this software and associated documentation files (the
  7. "Software"), to deal in the Software without restriction, including
  8. without limitation the rights to use, copy, modify, merge, publish,
  9. distribute, sublicense, and/or sell copies of the Software, and to
  10. permit persons to whom the Software is furnished to do so, subject to
  11. the following conditions:
  12. The above copyright notice and this permission notice shall be included
  13. in all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  17. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  18. CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  19. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  20. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. ***************************************************************************/
  22. @import UIKit;
  23. @interface UIView (Toast)
  24. // each makeToast method creates a view and displays it as toast
  25. - (void)makeToast:(NSString *)message;
  26. - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position;
  27. - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position image:(UIImage *)image;
  28. - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title;
  29. - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title image:(UIImage *)image;
  30. // displays toast with an activity spinner
  31. - (void)makeToastActivity;
  32. - (void)makeToastActivity:(id)position;
  33. - (void)hideToastActivity;
  34. // the showToast methods display any view as toast
  35. - (void)showToast:(UIView *)toast;
  36. - (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point;
  37. - (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point
  38. tapCallback:(void(^)(void))tapCallback;
  39. @end