UIFactory.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. //
  2. // UIFactory.h
  3. // SmartMeeting
  4. //
  5. // Created by luddong on 12-3-30.
  6. // Copyright (c) 2012年 Twin-Fish. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #define g_UIFactory [UIFactory sharedUIFactory]
  10. @interface UIFactory : NSObject
  11. /**--------------------------------
  12. * Create UITextField
  13. *
  14. * frame :CGRect
  15. * delegate :id<UITextFieldDelegate>
  16. * returnKeyType :UIReturnKeyType
  17. * secureTextEntry :BOOL
  18. * placeholder :NSString
  19. * font :UIFont
  20. *
  21. */
  22. + (id)createTextFieldWith:(CGRect)frame
  23. delegate:(id<UITextFieldDelegate>)delegate
  24. returnKeyType:(UIReturnKeyType)returnKeyType
  25. secureTextEntry:(BOOL)secureTextEntry
  26. placeholder:(NSString *)placeholder
  27. font:(UIFont *)font;
  28. /**--------------------------------
  29. * Create UILabel
  30. *
  31. * frame :CGRect
  32. * label :NSString
  33. *
  34. */
  35. + (id)createLabelWith:(CGRect)frame
  36. text:(NSString *)text;
  37. /**--------------------------------
  38. * Create UILabel
  39. *
  40. * frame :CGRect
  41. * label :NSString
  42. *
  43. */
  44. + (id)createClearBackgroundLabelWith:(CGRect)frame
  45. text:(NSString *)text;
  46. /**--------------------------------
  47. * Create UILabel
  48. *
  49. * frame :CGRect
  50. * label :NSString
  51. * backgroundColor :UIColor
  52. *
  53. */
  54. + (id)createLabelWith:(CGRect)frame
  55. text:(NSString *)text
  56. backgroundColor:(UIColor *)backgroundColor;
  57. /**--------------------------------
  58. * Create UILabel
  59. *
  60. * frame :CGRect
  61. * label :NSString
  62. * font :UIFont
  63. * textColor :UIColor
  64. * backgroundColor :UIColor
  65. *
  66. */
  67. + (id)createLabelWith:(CGRect)frame
  68. text:(NSString *)text
  69. font:(UIFont *)font
  70. textColor:(UIColor *)textColor
  71. backgroundColor:(UIColor *)backgroundColor;
  72. /**--------------------------------
  73. * Convert Resizable (Stretchable) Image;
  74. *
  75. * title :NSString *
  76. * message :NSString *
  77. */
  78. +(UIView*)createLine:(UIColor*)color parent:(UIView*)parent;
  79. +(UIView*)createLine:(UIView*)parent;
  80. + (UIImage*)resizableImageWithSize:(CGSize)size
  81. image:(UIImage*)image;
  82. + (UIButton *)createCommonButton:(NSString *)title target:(id)target action:(SEL)selector;
  83. + (UIButton *)createButtonWithTitle:(NSString *)title
  84. titleFont:(UIFont *)font
  85. titleColor:(UIColor *)titleColor
  86. normal:(NSString *)normalImage
  87. highlight:(NSString *)clickIamge;
  88. + (UIButton *)createButtonWithImage:(NSString *)normalImage
  89. highlight:(NSString *)clickIamge
  90. target:(id)target
  91. selector:(SEL)selector;
  92. + (UIButton *)createButtonWithImage:(NSString *)normalImage
  93. selected:(NSString *)clickIamge
  94. target:(id)target
  95. selector:(SEL)selector;
  96. + (UIButton *)createButtonWithTitle:(NSString *)title
  97. titleFont:(UIFont *)font
  98. titleColor:(UIColor *)titleColor
  99. normal:(NSString *)normalImage
  100. highlight:(NSString *)clickIamge
  101. selected:(NSString *)selectIamge;
  102. + (UIButton *)createButtonWithRect:(CGRect)frame
  103. title:(NSString *)title
  104. titleFont:(UIFont *)font
  105. titleColor:(UIColor *)titleColor
  106. normal:(NSString *)normalImage
  107. selected:(NSString *)clickIamge
  108. selector:(SEL)selector
  109. target:(id)target;
  110. + (UIButton *)createButtonWithRect:(CGRect)frame
  111. title:(NSString *)title
  112. titleFont:(UIFont *)font
  113. titleColor:(UIColor *)titleColor
  114. normal:(NSString *)normalImage
  115. highlight:(NSString *)clickIamge
  116. selector:(SEL)selector
  117. target:(id)target;
  118. + (UIButton *)createButtonWithRect:(CGRect)frame
  119. title:(NSString *)title
  120. titleFont:(UIFont *)font
  121. titleColor:(UIColor *)titleColor
  122. normal:(NSString *)normalImage
  123. highlight:(NSString *)clickIamge
  124. fixed:(CGSize)fixedSize
  125. selector:(SEL)selector
  126. target:(id)target;
  127. + (UIButton *)createButtonWithRect:(CGRect)frame
  128. title:(NSString *)title
  129. titleFont:(UIFont *)font
  130. titleColor:(UIColor *)titleColor
  131. normal:(NSString *)normalImage
  132. highlight:(NSString *)clickIamge
  133. selected:(NSString *)selectedImage
  134. selector:(SEL)selector
  135. target:(id)target;
  136. + (UITextField *)createTextFieldWithRect:(CGRect)frame
  137. keyboardType:(UIKeyboardType)keyboardType
  138. secure:(BOOL)secure
  139. placeholder:(NSString *)placeholder
  140. font:(UIFont *)font
  141. color:(UIColor *)color
  142. delegate:(id)delegate;
  143. +(UIButton*)createCheckButtonWithRect:(CGRect)frame
  144. selector:(SEL)selector
  145. target:(id)target;
  146. + (UIButton *)createRadioButtonWithRect:(CGRect)frame
  147. normalImage:(NSString *)normalImage
  148. selectedImage:(NSString *)selectedImage
  149. labelText:(NSString *)labelText
  150. textColor:(UIColor*)textColor
  151. selector:(SEL)selector
  152. target:(id)target
  153. thisView:(UIView*)thisView;
  154. + (UIButton *)createRadioButtonWithRect:(CGRect)frame
  155. labelText:(NSString *)labelText
  156. textColor:(UIColor*)textColor
  157. selector:(SEL)selector
  158. target:(id)target
  159. thisView:(UIView*)thisView;
  160. +(UIButton*)createTopButton:(NSString*)s action:(SEL)action target:(id)target;
  161. + (NSString *)localized:(NSString *)key;
  162. /**--------------------------------
  163. * Check Network Address Validation
  164. *
  165. * address :NSString *
  166. */
  167. + (BOOL)isValidIPAddress:(NSString *)address;
  168. + (BOOL)isValidPortAddress:(NSString *)address;
  169. + (BOOL)checkIntValueRange:(NSString *)value min:(int)min max:(int)max;
  170. + (NSString *)checkValidName:(NSString *)value;
  171. + (NSString *)checkValidPhoneNumber:(NSString *)value;
  172. + (void)dissAlert;
  173. + (void)showAlert:(NSString *)message;
  174. + (void)showAlert:(NSString *)message tag:(NSUInteger)tag delegate:(id)delegate;
  175. + (void)showConfirm:(NSString *)message tag:(NSUInteger)tag delegate:(id)delegate;
  176. + (NSString *)stringFromDate:(NSDate *)date format:(NSString *)formatStr;
  177. + (NSDate *)dateFromString:(NSString *)str format:(NSString *)formatStr;
  178. +(void)freeTable:(NSMutableArray*)pool;
  179. +(void)addToPool:(NSMutableArray*)pool object:(NSObject*)object;
  180. + (UIFactory*)sharedUIFactory;
  181. +(void)onGotoBack:(UIViewController*)vc;
  182. -(void)removeAllChild:(UIView*)parent;
  183. @property (nonatomic, strong) UIFont* font7;
  184. @property (nonatomic, strong) UIFont* font8;
  185. @property (nonatomic, strong) UIFont* font9;
  186. @property (nonatomic, strong) UIFont* font10;
  187. @property (nonatomic, strong) UIFont* font11;
  188. @property (nonatomic, strong) UIFont* font12;
  189. @property (nonatomic, strong) UIFont* font13;
  190. @property (nonatomic, strong) UIFont* font14;
  191. @property (nonatomic, strong) UIFont* font15;
  192. @property (nonatomic, strong) UIFont* font16;
  193. @property (nonatomic, strong) UIFont* font17;
  194. @property (nonatomic, strong) UIFont* font18;
  195. @property (nonatomic, strong) UIFont* font20;
  196. @property (nonatomic, strong) UIFont* font24;
  197. @property (nonatomic, strong) UIFont* font28;
  198. @property (nonatomic, strong) UIFont* font7b;
  199. @property (nonatomic, strong) UIFont* font8b;
  200. @property (nonatomic, strong) UIFont* font9b;
  201. @property (nonatomic, strong) UIFont* font10b;
  202. @property (nonatomic, strong) UIFont* font11b;
  203. @property (nonatomic, strong) UIFont* font12b;
  204. @property (nonatomic, strong) UIFont* font13b;
  205. @property (nonatomic, strong) UIFont* font14b;
  206. @property (nonatomic, strong) UIFont* font15b;
  207. @property (nonatomic, strong) UIFont* font16b;
  208. @property (nonatomic, strong) UIFont* font17b;
  209. @property (nonatomic, strong) UIFont* font18b;
  210. @property (nonatomic, strong) UIFont* font20b;
  211. @property (nonatomic, strong) UIFont* font24b;
  212. @property (nonatomic, strong) UIFont* font28b;
  213. @end
  214. @interface UIImage (ImageNamed)
  215. + (UIImage *)imageNamed:(NSString *)name;
  216. @end
  217. extern NSString *kStyle2Dir;