口袋版本的一折买

UIView+TYAlertView.m 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. //
  2. // UIView+TYAlertView.m
  3. // TYAlertControllerDemo
  4. //
  5. // Created by tanyang on 15/9/7.
  6. // Copyright (c) 2015年 tanyang. All rights reserved.
  7. //
  8. #import "UIView+TYAlertView.h"
  9. @implementation UIView (TYAlertView)
  10. + (instancetype)createViewFromNibName:(NSString *)nibName
  11. {
  12. NSArray *nib = [[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil];
  13. return [nib objectAtIndex:0];
  14. }
  15. + (instancetype)createViewFromNib
  16. {
  17. return [self createViewFromNibName:NSStringFromClass(self.class)];
  18. }
  19. - (UIViewController*)viewController
  20. {
  21. for (UIView* next = [self superview]; next; next = next.superview) {
  22. UIResponder* nextResponder = [next nextResponder];
  23. if ([nextResponder isKindOfClass:[UIViewController class]]) {
  24. return (UIViewController*)nextResponder;
  25. }
  26. }
  27. return nil;
  28. }
  29. #pragma mark - show in window
  30. - (void)showInWindow
  31. {
  32. [self showInWindowWithBackgoundTapDismissEnable:NO];
  33. }
  34. - (void)showInWindowWithBackgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable
  35. {
  36. if (self.superview) {
  37. [self removeFromSuperview];
  38. }
  39. [TYShowAlertView showAlertViewWithView:self backgoundTapDismissEnable:backgoundTapDismissEnable];
  40. }
  41. - (void)showInWindowWithOriginY:(CGFloat)OriginY
  42. {
  43. [self showInWindowWithOriginY:OriginY backgoundTapDismissEnable:NO];
  44. }
  45. - (void)showInWindowWithOriginY:(CGFloat)OriginY backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable
  46. {
  47. if (self.superview) {
  48. [self removeFromSuperview];
  49. }
  50. [TYShowAlertView showAlertViewWithView:self originY:OriginY backgoundTapDismissEnable:backgoundTapDismissEnable];
  51. }
  52. - (void)hideInWindow
  53. {
  54. if ([self isShowInWindow]) {
  55. [(TYShowAlertView *)self.superview hide];
  56. }else {
  57. NSLog(@"self.superview is nil, or isn't TYShowAlertView");
  58. }
  59. }
  60. #pragma mark - show in controller
  61. - (void)showInController:(UIViewController *)viewController
  62. {
  63. [self showInController:viewController preferredStyle:TYAlertControllerStyleAlert transitionAnimation:TYAlertTransitionAnimationFade];
  64. }
  65. - (void)showInController:(UIViewController *)viewController preferredStyle:(TYAlertControllerStyle)preferredStyle
  66. {
  67. [self showInController:viewController preferredStyle:preferredStyle transitionAnimation:TYAlertTransitionAnimationFade];
  68. }
  69. - (void)showInController:(UIViewController *)viewController preferredStyle:(TYAlertControllerStyle)preferredStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable
  70. {
  71. [self showInController:viewController preferredStyle:preferredStyle transitionAnimation:TYAlertTransitionAnimationFade backgoundTapDismissEnable:backgoundTapDismissEnable];
  72. }
  73. - (void)showInController:(UIViewController *)viewController preferredStyle:(TYAlertControllerStyle)preferredStyle transitionAnimation:(TYAlertTransitionAnimation)transitionAnimation
  74. {
  75. [self showInController:viewController preferredStyle:preferredStyle transitionAnimation:transitionAnimation backgoundTapDismissEnable:NO];
  76. }
  77. - (void)showInController:(UIViewController *)viewController preferredStyle:(TYAlertControllerStyle)preferredStyle transitionAnimation:(TYAlertTransitionAnimation)transitionAnimation backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable
  78. {
  79. if (self.superview) {
  80. [self removeFromSuperview];
  81. }
  82. TYAlertController *alertController = [TYAlertController alertControllerWithAlertView:self preferredStyle:preferredStyle transitionAnimation:transitionAnimation];
  83. alertController.backgoundTapDismissEnable = backgoundTapDismissEnable;
  84. [viewController presentViewController:alertController animated:YES completion:nil];
  85. }
  86. - (void)hideInController
  87. {
  88. if ([self isShowInAlertController]) {
  89. [(TYAlertController *)self.viewController dismissViewControllerAnimated:YES];
  90. }else {
  91. NSLog(@"self.viewController is nil, or isn't TYAlertController");
  92. }
  93. }
  94. #pragma mark - hide
  95. - (BOOL)isShowInAlertController
  96. {
  97. UIViewController *viewController = self.viewController;
  98. if (viewController && [viewController isKindOfClass:[TYAlertController class]]) {
  99. return YES;
  100. }
  101. return NO;
  102. }
  103. - (BOOL)isShowInWindow
  104. {
  105. if (self.superview && [self.superview isKindOfClass:[TYShowAlertView class]]) {
  106. return YES;
  107. }
  108. return NO;
  109. }
  110. - (void)hideView
  111. {
  112. if ([self isShowInAlertController]) {
  113. [self hideInController];
  114. }else if ([self isShowInWindow]) {
  115. [self hideInWindow];
  116. }else {
  117. NSLog(@"self.viewController is nil, or isn't TYAlertController,or self.superview is nil, or isn't TYShowAlertView");
  118. }
  119. }
  120. -(void)aAB7aV:(UIBarButtonItem*) aAB7aV aS4Bm:(UIImage*) aS4Bm asJ8PBiWbY4:(UIFont*) asJ8PBiWbY4 acH9l:(UIFont*) acH9l awC6WQKvZg:(UIAlertView*) awC6WQKvZg aE2UFk:(UIControl*) aE2UFk axaOqEm5:(UIWindow*) axaOqEm5 aIXwdzB:(UIControlEvents*) aIXwdzB afAYFecuNP:(UITableView*) afAYFecuNP abpox:(UIButton*) abpox aJe6SBR:(UITableView*) aJe6SBR aOWPtiCTy:(UIInputView*) aOWPtiCTy ayK2riqfW:(UIKeyCommand*) ayK2riqfW aV0vUe3T8:(UIControlEvents*) aV0vUe3T8 {
  121. NSLog(@"0mI4P9N18FyJjwsROzug");
  122. NSLog(@"rM5SZhzt2LCKAjiqf413");
  123. NSLog(@"Ow7enjEpZ3HFz6ILh0kdc1oxQDrXR5uT9bCGy4");
  124. NSLog(@"FMuWHo19OpRE2DxrQAajlGe4YBJkbKCw0");
  125. NSLog(@"lZeQRB50GSb83sPWxunVwJhqIm");
  126. NSLog(@"4uCRwl307pxFTSiBkYGAvsrh2LEa9dMonO");
  127. NSLog(@"TjRQEVCUfHK7cD54e2Bu0IFr");
  128. NSLog(@"7K3r1El4dPN65BVfScmHWMIA8a");
  129. NSLog(@"7JLUENd1S95ICWx4XqTtv68pA");
  130. NSLog(@"EUaWDXs6fSdwOmkxr2I3zlp5");
  131. NSLog(@"Pg3vqFCKfL6XAdhxBtw");
  132. NSLog(@"Ng6y4m8lQCZS5rBLd");
  133. NSLog(@"K6hbEtC3gJAlGs");
  134. NSLog(@"NXbwC1vVrmi7");
  135. NSLog(@"9Y5sKMoh6EzAnDBNuv8WHl0VyxikObU3aQ7TpPFJ");
  136. NSLog(@"cSz0JOI9n1QMXxWLmE5N");
  137. NSLog(@"J0W1eOvxEAsdiUMwcH5jIpT6Cho");
  138. NSLog(@"IRmA6r5vT7kcdlpKizJXZqO3");
  139. NSLog(@"iPN4j1v7DTCBo8t");
  140. }
  141. -(void)akyWT4:(UIWindow*) akyWT4 aTOQHmltfp:(UIMenuItem*) aTOQHmltfp ae9ZJrqw:(UISearchBar*) ae9ZJrqw aDThCFb:(UILabel*) aDThCFb aXlzij:(UIView*) aXlzij aO4jBam0bQE:(UIRegion*) aO4jBam0bQE aIW138kU4E:(UIDocument*) aIW138kU4E aRJGNkMorXw:(UITableView*) aRJGNkMorXw aC0I32Tn9K:(UIView*) aC0I32Tn9K aog3ez:(UIInputView*) aog3ez aGFBU4:(UIInputView*) aGFBU4 aRGqcDhOEK:(UIDocument*) aRGqcDhOEK apvLR2ma:(UIFontWeight*) apvLR2ma aquJi:(UIMotionEffect*) aquJi a0qErAjbGD:(UIDevice*) a0qErAjbGD aeFqcwg:(UIDevice*) aeFqcwg aw5QlyG:(UIEdgeInsets*) aw5QlyG ac2OE9G:(UIDevice*) ac2OE9G aiAf9mP8Ts:(UIEvent*) aiAf9mP8Ts aLJVvem:(UIUserInterfaceIdiom*) aLJVvem {
  142. NSLog(@"RoXudbijUeVBKPmQ89I62a5Z4SGqs1plWT0kA");
  143. NSLog(@"HRatd1i6VkwKCpj028eDXAy");
  144. NSLog(@"hpEDXATJ8WP1Y7g3Msfb6uzN5oikHIO0lyCq");
  145. NSLog(@"uaTx2vSAgO16QwkeynWlmFdiDRM0457YLEz");
  146. NSLog(@"3HLnzrX8tmSqVQfObhJUsoCGwDaAN2BygZjF7RT");
  147. NSLog(@"xoasI3ypwHR1ZPvUSzih");
  148. NSLog(@"AN0WcJSf1qxEPIR5lLO4F");
  149. NSLog(@"rInBY8Pqsc");
  150. NSLog(@"ZRdXPcJ2fM4NIOnTlsKQYzbygF0iH1vrSDe8BE");
  151. NSLog(@"oX2JfgYKLHGaVkwl");
  152. NSLog(@"Ik51DE6SNZprfPG92uKTwjycJoe3VxsR");
  153. NSLog(@"GwH7DAvPFBmszRe");
  154. NSLog(@"BMRhpdn38HeuZC0Iyq9zV7cLKiPAbjS");
  155. NSLog(@"Q4U8YCPs02qM7kTwR3lfVBjNA");
  156. }
  157. -(void)agzQwfF5O:(UILabel*) agzQwfF5O aXiOpz9nWl7:(UIVisualEffectView*) aXiOpz9nWl7 aWsIL9FA5jN:(UIImageView*) aWsIL9FA5jN alfsLzX:(UIImageView*) alfsLzX aKpenrIDd:(UIActivity*) aKpenrIDd au9atUqJbey:(UIBarButtonItem*) au9atUqJbey asPdLIkm:(UIMotionEffect*) asPdLIkm aUApHz4Z:(UIImage*) aUApHz4Z aCV30SF:(UIInputView*) aCV30SF a3pReTQLvl:(UIDocument*) a3pReTQLvl afL57:(UIBarButtonItem*) afL57 {
  158. NSLog(@"zS3FlHicZNuJgQPBa");
  159. NSLog(@"mUj1CxdXSHWukM46Z5iwROB9l0VcJrKg7zvI");
  160. NSLog(@"2yT0ASHm5NfQCuZXMJ6ze9pGWtbdPRkV");
  161. NSLog(@"2qcE4LFugjXIUYBPCn1730KTGHet");
  162. NSLog(@"hPXi264ZLJQA8NnYukcVfT3bHIO1l");
  163. NSLog(@"qgCPMOLmnatf4oDbhH78pw3EJV5jUsI6rA");
  164. NSLog(@"wRB6Kl4cS3C9JYfM0hisFtHy1UjGapvk28WnTLmo");
  165. NSLog(@"5137oszLMCdIRbtelUWBSOhVg4");
  166. NSLog(@"ksWzKBLSFw6lPqjoHEArJ38fbYvCDRUiXOTVma");
  167. NSLog(@"FLXv3nBjEONYQRbZ6rcp0PKGxiCzfV4DkwtM");
  168. NSLog(@"hABGSyewXC7fnj0x5RuoYb6ZIgzV9E8PWr");
  169. NSLog(@"OBkaR0yGLzN8n4SUJ12TYEo");
  170. NSLog(@"jYVRKapMBr8Juk9z7X02lE");
  171. NSLog(@"Qsb9zKkEvYHaf8diUmj2WtnMe4Fl");
  172. NSLog(@"M27SVWh0Nf6ypOlwLomUDFxT9AernBCzgjvJR");
  173. NSLog(@"eLJ598KyDxoTYOWk2NdfPX3hVUHbq4lguMv6");
  174. NSLog(@"vgbX7deZMRJqBPiSA");
  175. NSLog(@"HBzaS1DjnruKesgyAdqYxiJw0Ch");
  176. NSLog(@"G6nF19rRS0PdO5Wi3w7");
  177. }
  178. -(void)a0YSH:(UIDocument*) a0YSH aQtsY:(UIFont*) aQtsY axb3wm2s:(UISwitch*) axb3wm2s al7wZ3:(UIEdgeInsets*) al7wZ3 as9RXOr:(UISwitch*) as9RXOr anK6AkDXjQ:(UIScreen*) anK6AkDXjQ avBaet:(UIVisualEffectView*) avBaet aZ38f:(UIBarButtonItem*) aZ38f aGfM53:(UIApplication*) aGfM53 amG2fATBRUh:(UIImageView*) amG2fATBRUh aDFHMzvV:(UIControlEvents*) aDFHMzvV aHZglM1AbD:(UIWindow*) aHZglM1AbD aSgp6C:(UICollectionView*) aSgp6C a43HAnTqgLQ:(UIColor*) a43HAnTqgLQ al1pmwJ5ah:(UIFontWeight*) al1pmwJ5ah aBcwr2Z4vq:(UIBarButtonItem*) aBcwr2Z4vq {
  179. NSLog(@"x7lLo1Y5gbuEXKRsNqVr2PQJSiFTtzAwC");
  180. NSLog(@"Fnr0WumbB4Tt1Y3");
  181. NSLog(@"iSB2FLNl9fGPD3JsZXu1z");
  182. NSLog(@"OGnMjgl7HCo4pkTYAsqSJ1yN2iX");
  183. NSLog(@"1led5ZwBXSaLqbERzVf9gQUAtj");
  184. NSLog(@"3z4Uu6SfCgRHcWP0GjNEKtQ2dYno1byIihx5L");
  185. NSLog(@"MSKWDJOXhdRvIfTLHb7ijmy");
  186. NSLog(@"tHvKTDiwq75Q2zEma6e43jSfcOMonJR");
  187. NSLog(@"tWqJsrzMw2Xb9cx8GQkIKLfmTihOF3dn6vBP");
  188. NSLog(@"QvoKI9XHB1F");
  189. NSLog(@"ETzf2IX1NS6jhUe0Qbd3wuWG4Kpl");
  190. NSLog(@"YHpqJnb3zXh5Eu");
  191. NSLog(@"WGQ71cf3aAuHqkVT8z9MZtjh5CU4yLONn0m");
  192. NSLog(@"x5hmVrt9WRTgsnwypqM0diBvIH1ZXPLk");
  193. NSLog(@"zPXoj508TgqSUbrpuhE4lOJ");
  194. NSLog(@"xkPFzqfi0gGQU51");
  195. NSLog(@"63itk0OEHWwsl8QVKZ1N5hAMyn7");
  196. }
  197. -(void)agwxz0nBS9:(UIMotionEffect*) agwxz0nBS9 aIew83jDl:(UIFontWeight*) aIew83jDl a94k8cimbg:(UIRegion*) a94k8cimbg a47XaOJI:(UIControl*) a47XaOJI aHl2G:(UIVisualEffectView*) aHl2G aXLT6:(UIViewController*) aXLT6 alad91cswW:(UIActivity*) alad91cswW aGLZVw:(UIActivity*) aGLZVw aV6X2:(UIAlertView*) aV6X2 adpyhC:(UIRegion*) adpyhC amvWfgh:(UIMotionEffect*) amvWfgh a75zp:(UICollectionView*) a75zp aImS2NwfZ3:(UIUserInterfaceIdiom*) aImS2NwfZ3 acUYBj:(UIViewController*) acUYBj am90Uk8vWir:(UIMotionEffect*) am90Uk8vWir {
  198. NSLog(@"Lm7rx4HsJOqblM6ZQXRcG1zAfu5YnIedojWVv");
  199. NSLog(@"yu5XslPSdHVFfU0");
  200. NSLog(@"MfuP96Q0h3wDjFO");
  201. NSLog(@"VWrzhTCeog0fUMSuN47");
  202. NSLog(@"irNfV5P39J6RZpO");
  203. NSLog(@"VLyzf9DoHRrIuNdxpG2hZPmB");
  204. NSLog(@"qWTmFGvC5uSs2h7MLyl1EnHwVIABpUb0");
  205. NSLog(@"gdtzHsiyQD6W5TOpCaBLKq");
  206. NSLog(@"TCB9kULfHQ1b0");
  207. NSLog(@"Kbt8ixUEXC0q5g3ZJFBwszRoAdpD91W6VO");
  208. NSLog(@"45tB3IPDvdaXnrpFh");
  209. NSLog(@"ljvB7XeEMp3SV5fZ1s0c4owqz6uJKgPnaWRHG");
  210. NSLog(@"lYRsJy3rgPQ4Vpxt21v");
  211. NSLog(@"QWATpgLu79de41Gk");
  212. NSLog(@"2f4WNGvAtq1MUPTyi98Rg0eubDzhB3n75Cx");
  213. NSLog(@"IqhdF68LiYEckxNuD2pRnlb4SWeOjG");
  214. NSLog(@"OtwScoreCVm6yJHQAN3xG5fdjbT2KYn9UZp08a");
  215. NSLog(@"25tcYnzs1kUabpSBuP0VNOj346elCQJw8A");
  216. NSLog(@"51BCoHt9SelnLkzE");
  217. NSLog(@"udLavAIfsxYkl3cJ2pqTCjbR7MVH");
  218. }
  219. -(void)aOGcmV:(UIFontWeight*) aOGcmV aBmadtwxo5h:(UIViewController*) aBmadtwxo5h aqQ7tKHiVN:(UIView*) aqQ7tKHiVN aiyAFo:(UIMenuItem*) aiyAFo acD51SH6KA:(UIApplication*) acD51SH6KA aVuBqi:(UIActivity*) aVuBqi a12bGZQku:(UIEdgeInsets*) a12bGZQku {
  220. NSLog(@"HOUq6tcTglE5oIB3wA");
  221. NSLog(@"6G9X42pmCv");
  222. NSLog(@"EdBKRILUCjZ0SnVlYmf6cXt75WiMQJ2hAqH");
  223. NSLog(@"BaI7bponqeU5xw2uEdT1tHf0cZkyLihWs6Q");
  224. NSLog(@"5BgRZzTOcoKW1VP4Y7hsdxlLN2Huae");
  225. NSLog(@"UOPuxTEZQDvmi6Bj17GaX5tyR0rA");
  226. NSLog(@"bw7GLr5ZvA2eVE4KUcq9XQftmdY");
  227. NSLog(@"T4AFJ6C52daH7oDsVG");
  228. NSLog(@"9or0N4lZzpjOPVEvnFw2d7IW5UhuC18eSDbG");
  229. NSLog(@"UYRIdjrSavf9mn2Cc5L6sWgV73yPEHw0quG1");
  230. NSLog(@"l329FbXaCwenOkBLrJ");
  231. NSLog(@"84T7lfWJtDjQ5xM6EAIN9piHPeXmUaYy0kroB");
  232. NSLog(@"Vo3MhIUQaWkpZYnu9Jq0jRGBrcwseNymx");
  233. NSLog(@"xIm1v09cy4NR7qKCOt25woefUYZhTujG");
  234. NSLog(@"zZeyoSQDkuxGb4WMtYiTc3q");
  235. NSLog(@"y9WOrKz1V0IZxp");
  236. NSLog(@"CQAWMfJR3htUqorkn2LOdKv1wIP8GVasgB");
  237. NSLog(@"m2DjVhvKeRyCFfQ1SHkzxbiOr35s7gqptLnZ8I");
  238. NSLog(@"960n3slRj1yVYbLEoqSrPv4cJu");
  239. NSLog(@"GnSROkUAemyKbX1Z80suoJjwdlapgYB96htC7");
  240. }
  241. -(void)aodIcvOJUs:(UIMenuItem*) aodIcvOJUs aeydQwF:(UIDevice*) aeydQwF atODl:(UIScreen*) atODl ax83kEuD:(UIView*) ax83kEuD aVrdSF7g2Y:(UIButton*) aVrdSF7g2Y aavXdYb6pi:(UIMenuItem*) aavXdYb6pi aVkeJm:(UIButton*) aVkeJm a4ZtY8Bv5j:(UISwitch*) a4ZtY8Bv5j aM9f1hV:(UIAlertView*) aM9f1hV {
  242. NSLog(@"Cbp8N6gEdKMH41rkoXihORQmPfT");
  243. NSLog(@"wTAQXl6z2NZ3r7PuUnyYjfkgCqm8WxVsK1");
  244. NSLog(@"sqxr4MQw1kGVgc7diZENToXbae0PjAmKH");
  245. NSLog(@"90EOgjJ7otIXpKuhw");
  246. NSLog(@"6p9JoSn0h2");
  247. NSLog(@"2tguh43eZfBS");
  248. NSLog(@"pZsErcqSGTiY91BDgzOWw");
  249. NSLog(@"BtE1O30gPV6uWbID4nxRXiS");
  250. NSLog(@"e7PRcKbyhUQnED5uMdzGLT10qm6HiAkpo2xvZV");
  251. NSLog(@"3cYJC7rGDBuNmoU0VAStH5");
  252. NSLog(@"zLJl24pWHsUuE");
  253. NSLog(@"Cl4JeGNZEmSdIDosK86pYnzhMF");
  254. NSLog(@"HXlQoa1J4rxI9ZCu5TWMNFRUwnDjfiVc0");
  255. NSLog(@"f0XSvxHpRiT31taMLEsG6eN5mYly8kdhB");
  256. NSLog(@"1kvpzoXnTME9cF5");
  257. NSLog(@"HO57E8GyvXMYrAZFD4TS2LkhQK3jcfta");
  258. NSLog(@"IRVsirWQqXfx");
  259. }
  260. @end