iToast.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // iToast.h
  3. // iToast
  4. //
  5. // Created by Diallo Mamadou Bobo on 2/10/11.
  6. // Copyright 2011 __MyCompanyName__. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. typedef enum iToastGravity {
  11. iToastGravityTop = 1000001,
  12. iToastGravityBottom,
  13. iToastGravityCenter
  14. }iToastGravity;
  15. typedef enum iToastDuration {
  16. iToastDurationLong = 10000,
  17. iToastDurationShort = 1000,
  18. iToastDurationNormal = 2000
  19. }iToastDuration;
  20. typedef enum iToastType {
  21. iToastTypeInfo = -100000,
  22. iToastTypeNotice,
  23. iToastTypeWarning,
  24. iToastTypeError
  25. }iToastType;
  26. @class iToastSettings;
  27. @interface iToast : NSObject {
  28. iToastSettings *_settings;
  29. NSInteger offsetLeft;
  30. NSInteger offsetTop;
  31. NSTimer *timer;
  32. UIView *view;
  33. NSString *text;
  34. }
  35. - (iToast *) settings;
  36. - (void) show;
  37. - (iToast *) setDuration:(NSInteger ) duration;
  38. - (iToast *) setGravity:(iToastGravity) gravity
  39. offsetLeft:(NSInteger) left
  40. offsetTop:(NSInteger) top;
  41. - (iToast *) setGravity:(iToastGravity) gravity;
  42. - (iToast *) setPostion:(CGPoint) position;
  43. + (iToast *) makeText:(NSString *) text;
  44. -(iToastSettings *) theSettings;
  45. @end
  46. @interface iToastSettings : NSObject<NSCopying>{
  47. NSInteger duration;
  48. iToastGravity gravity;
  49. CGPoint postition;
  50. iToastType toastType;
  51. NSDictionary *images;
  52. BOOL positionIsSet;
  53. }
  54. @property(assign) NSInteger duration;
  55. @property(assign) iToastGravity gravity;
  56. @property(assign) CGPoint postition;
  57. @property(readonly) NSDictionary *images;
  58. - (void) setImage:(UIImage *)img forType:(iToastType) type;
  59. + (iToastSettings *) getSharedSettings;
  60. @end