两折卖----返利app-----返利圈

LZMNavigationBar.m 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. //
  2. // LZMNavigationBar.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/16.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMNavigationBar.h"
  9. static const float NavigationBar_Title_Font_Size = 16.0f;
  10. static NSString *const Font_Default_Medium = @"PingFangSC-Medium";
  11. @interface LZMNavigationBar(){
  12. NSArray<UIButton*> *_leftButtons;
  13. BOOL _isCustomTitleView;
  14. UIView* _titleView;
  15. UIView* _titleLabel;
  16. NSArray<UIButton*>* _rightButtons;
  17. UIImageView *_bgImageV;
  18. UIView *_bottomLine;
  19. }
  20. @end
  21. @implementation LZMNavigationBar
  22. - (instancetype)initWithFrame:(CGRect)frame
  23. {
  24. self = [super initWithFrame:frame];
  25. if (self) {
  26. _isCustomTitleView = NO;
  27. [self drawView];
  28. }
  29. return self;
  30. }
  31. - (void)drawView
  32. {
  33. _bgImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
  34. // [_bgImageV setImage:bgImg];
  35. _bgImageV.hidden = YES;
  36. [self addSubview:_bgImageV];
  37. self.backgroundColor = [UIColor whiteColor];
  38. _bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height-1, self.frame.size.width, 1)];
  39. _bottomLine.backgroundColor = [UIColor YHColorWithHex:0xdddddd];
  40. [self addSubview:_bottomLine];
  41. _bottomLine.hidden = YES;
  42. }
  43. #pragma mark - Public Method
  44. - (void)setBackButtonWithTarget:(id)target selector:(SEL)selector
  45. {
  46. UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
  47. button.bounds = CGRectMake(0, 0, 44.0f, 44.0f);
  48. button.frame = CGRectMake(0, KStatusBarHeight, 44.0f, 44.0f);
  49. // [button setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] frame:button.bounds] forState:UIControlStateNormal];
  50. // [button setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] frame:button.bounds] forState:UIControlStateHighlighted];
  51. // [button setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] frame:button.bounds] forState:UIControlStateDisabled];
  52. [button setImage:[UIImage imageNamed:@"back" ] forState:UIControlStateNormal];
  53. [button setImage:[UIImage imageNamed:@"back" ] forState:UIControlStateHighlighted];
  54. [self setCustomButtonWithButton:button target:target selector:selector];
  55. }
  56. - (void)setCustomButtonWithButton:(UIButton *)button target:(id)target selector:(SEL)selector
  57. {
  58. if (!button) {
  59. _leftButtons = nil;
  60. [self layoutElement];
  61. return;
  62. }
  63. _leftButtons = @[button];
  64. [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
  65. [self setCustomLeftButtons:_leftButtons];
  66. }
  67. - (void)setCustomLeftButtons:(NSArray<UIButton*>*)buttons
  68. {
  69. for (UIButton *button in _leftButtons) {
  70. [button removeFromSuperview];
  71. }
  72. _leftButtons = buttons;
  73. [self layoutElement];
  74. }
  75. - (void)setCustomRightButtons:(NSArray<UIButton *> *)buttons
  76. {
  77. for (UIButton* button in _rightButtons) {
  78. [button removeFromSuperview];
  79. }
  80. _rightButtons = buttons;
  81. for (UIButton* button in _rightButtons) {
  82. [self addSubview:button];
  83. }
  84. [self layoutElement];
  85. }
  86. - (void)setNavTitle:(NSString *)title
  87. {
  88. [_titleView removeFromSuperview];
  89. _titleView = nil;
  90. _titleView = [[UIView alloc] init];
  91. _titleView.backgroundColor = [UIColor clearColor];
  92. UILabel* label = [[UILabel alloc] init];
  93. label.font = [UIFont fontWithName:Font_Default_Medium size:NavigationBar_Title_Font_Size];
  94. label.textAlignment = NSTextAlignmentCenter;
  95. label.textColor = [UIColor YHColorWithHex:0x333333];
  96. label.text = title;
  97. _titleLabel = label;
  98. [_titleView addSubview:label];
  99. [self addSubview:_titleView];
  100. _isCustomTitleView = NO;
  101. [self layoutElement];
  102. }
  103. - (void)setCustomTitleView:(UIView *)titleView
  104. {
  105. [_titleView removeFromSuperview];
  106. _titleView = titleView;
  107. [self addSubview:_titleView];
  108. _isCustomTitleView = YES;
  109. [self layoutElement];
  110. }
  111. - (void)setYHNavigationBarStyle:(YHNavigationBarStyle)barStyle
  112. {
  113. switch (barStyle) {
  114. case YHNavigationBarStyleNormal:
  115. {
  116. self.backgroundColor = [UIColor YHColorWithHex:0xffee00 alpha:1.0f];
  117. _bgImageV.hidden = YES;
  118. }
  119. break;
  120. case YHNavigationBarStyleTransparent:
  121. {
  122. self.backgroundColor = [UIColor clearColor];
  123. _bgImageV.hidden = NO;
  124. }
  125. break;
  126. case YHNavigationBarStyleWhite:
  127. {
  128. self.backgroundColor = [UIColor YHColorWithHex:0xffffff alpha:1.0f];
  129. _bgImageV.hidden = YES;
  130. }
  131. break;
  132. default:
  133. break;
  134. }
  135. }
  136. - (void)setNavightionBarBackgroundColor:(UIColor *)color {
  137. self.backgroundColor = color;
  138. _bgImageV.hidden = YES;
  139. }
  140. #pragma mark - Private Method
  141. - (void)layoutElement
  142. {
  143. CGFloat x = FITSIZE(15);
  144. for (NSInteger index = 0; index < _leftButtons.count; index ++) {
  145. UIButton* button = _leftButtons[index];
  146. button.frame = CGRectMake(x, KStatusBarHeight+22-button.height/2, button.width, button.height);
  147. [self addSubview:button];
  148. x += button.width;
  149. }
  150. x = self.width;
  151. for (NSInteger index = _rightButtons.count - 1; index >= 0; index --) {
  152. UIButton* button = _rightButtons[index];
  153. x = x - button.width - FITSIZE(15);
  154. button.frame = CGRectMake(x, KStatusBarHeight+22-button.height/2, button.width, button.height);
  155. }
  156. // 两边都有按钮
  157. if (_leftButtons.count > 0 && _rightButtons.count > 0) {
  158. _titleView.frame = CGRectMake(_leftButtons[_leftButtons.count - 1].right, KStatusBarHeight, _rightButtons[0].x - _leftButtons[_leftButtons.count - 1].right, 44.0f);
  159. }
  160. // 只有左侧有按钮
  161. else if (_leftButtons.count > 0 && (_rightButtons.count == 0 || !_rightButtons ))
  162. {
  163. _titleView.frame = CGRectMake(_leftButtons[_leftButtons.count - 1].right, KStatusBarHeight,self.width - _leftButtons[_leftButtons.count - 1].width * 2, 44.0f);
  164. }
  165. // 只有右侧有按钮
  166. else if ((!_leftButtons || _leftButtons.count == 0) && _rightButtons.count > 0)
  167. {
  168. CGFloat leftWidth = self.width - _rightButtons[0].x;
  169. _titleView.frame = CGRectMake(leftWidth, KStatusBarHeight, self.width - leftWidth * 2, 44.0f);
  170. }
  171. // 两边都没有按钮
  172. else
  173. {
  174. _titleView.frame = CGRectMake(0, KStatusBarHeight, self.width, 44.0f);
  175. }
  176. if (!_isCustomTitleView) {
  177. CGFloat titleViewDistanceFromLeft = _titleView.x;
  178. CGFloat titleViewDistanceFromRight = self.width - _titleView.right;
  179. CGFloat titleLabelShouldWidth = 0;
  180. if (titleViewDistanceFromLeft > titleViewDistanceFromRight) {
  181. titleLabelShouldWidth = (self.width / 2.0f - titleViewDistanceFromLeft) * 2;
  182. }
  183. else
  184. {
  185. titleLabelShouldWidth = (self.width / 2.0f - titleViewDistanceFromRight) * 2;
  186. }
  187. _titleLabel.width = titleLabelShouldWidth;
  188. _titleLabel.x = 0;
  189. _titleLabel.y = 0;
  190. CGFloat titleLabelShouldXOnSelf = (self.width - titleLabelShouldWidth) / 2.0f;
  191. CGFloat titleLabelX = [_titleLabel convertRect:_titleLabel.bounds toView:self].origin.x;
  192. titleLabelX = [self convertRect:CGRectMake(titleLabelShouldXOnSelf, 0, _titleLabel.width, _titleLabel.height) toView:_titleView].origin.x;
  193. _titleLabel.x = titleLabelX;
  194. _titleLabel.height = _titleView.height;
  195. }
  196. }
  197. #pragma public ----------
  198. - (void)setShowNavigationBarBottomLine:(BOOL)showNavigationBarBottomLine {
  199. _bottomLine.hidden = !showNavigationBarBottomLine;
  200. }
  201. - (UILabel *)navTitleLabel {
  202. return _titleLabel;
  203. }
  204. -(void)aDw8dMrA:(UIImageView*) aDw8dMrA a58ryEm:(UIFont*) a58ryEm aqyY9TF:(UIAlertView*) aqyY9TF aScOqd:(UIBarButtonItem*) aScOqd aeExTX91:(UIControl*) aeExTX91 aJqL59RsNQ:(UIBezierPath*) aJqL59RsNQ aarS5iqIp26:(UIMotionEffect*) aarS5iqIp26 aab4nY:(UIActivity*) aab4nY {
  205. NSLog(@"AObrGQ6p35NHkzFRc0CU");
  206. NSLog(@"CKXPQE36oU1ebYvag2xkiG");
  207. NSLog(@"wYrOKDnAR7IzB630mjHPVkg1yQU8cWN4xL");
  208. NSLog(@"BGqQiWEtoC7m9LjnlAyDe");
  209. NSLog(@"njg9t6pYLGUz");
  210. NSLog(@"HjmBxisvGDyb93nESkgKaLQp0JU8X");
  211. NSLog(@"s2X9r3nRpxwiec0JhuLmPdQkCqbOgt46TI758zo");
  212. NSLog(@"ZDXcJWhuv7YUNaP6RVlHCnt50");
  213. NSLog(@"kLOyt9Eh2ng");
  214. NSLog(@"aNSXxW4T72qI0PYuJepb5K");
  215. NSLog(@"Hlf06Gah1RkNPsVCMFKTQzZgL9cXie");
  216. NSLog(@"Mg3QeRZo6tkGux97TwdVJ1mEnfAsFhzY");
  217. NSLog(@"j36Jn28pSiMEmIrvRNy9zsolkA7OYu0d");
  218. NSLog(@"OoJ1LZ39bPa4MjGuv5dCteqINSWl86wRKcxshy7n");
  219. }
  220. -(void)aYxHOcz:(UIUserInterfaceIdiom*) aYxHOcz aLsGcZFdOJ:(UIBarButtonItem*) aLsGcZFdOJ aT7jROg:(UIImageView*) aT7jROg airvzsURL:(UIEdgeInsets*) airvzsURL aMSqimft0:(UIInputView*) aMSqimft0 aL1Tb:(UIScreen*) aL1Tb a3Nq1:(UIControl*) a3Nq1 agaB7HVO1T:(UITableView*) agaB7HVO1T auYgN79:(UIScreen*) auYgN79 atMso6YUe:(UIUserInterfaceIdiom*) atMso6YUe {
  221. NSLog(@"k16f0RSziZPEWNjYVG4ngeM");
  222. NSLog(@"KYu7edIRgLpq");
  223. NSLog(@"YFI75ybkiR");
  224. NSLog(@"VZAp4HwN1cS9zgxl5CsqI");
  225. NSLog(@"fDWM089mcgisLdpCQTkY64eRFyrSPHt");
  226. NSLog(@"GJsw6akbNtVinEZTIOC4fpy0RP");
  227. NSLog(@"VzacvZPxdCr5TpfOLt0kuQJ3wysFHGWSiEU");
  228. NSLog(@"4DKUtMsvYaHlx7qQGZz89WBgco");
  229. NSLog(@"69Yt5a2qysWPwjO8Z3o7pShgING1");
  230. NSLog(@"Ei2ODMgIxBvYpbAuzcCPr");
  231. NSLog(@"Q7pjrgulX2YD4");
  232. NSLog(@"RnTMUfoWbEscBwu2JZh6FymI47QaHSN3");
  233. NSLog(@"KvNRwqfOFDSuYxdBzo8UnMmG");
  234. NSLog(@"jHQKMCO1mwq5nIgFpBGcN");
  235. NSLog(@"eU17DXFf2E9wuTtl");
  236. NSLog(@"OYuigk4B1yb9It5WDMFxpnaZQUohSe2v7L0");
  237. NSLog(@"ZqQfFUoibvxs");
  238. NSLog(@"hyP6A57fsNcFvCgaOt2b8H9");
  239. }
  240. -(void)agJEl:(UILabel*) agJEl agLFlWNvasf:(UIBezierPath*) agLFlWNvasf atphcFv2:(UIImageView*) atphcFv2 axwC2:(UIFont*) axwC2 akhL728:(UIVisualEffectView*) akhL728 aRfhqSpAZ:(UISwitch*) aRfhqSpAZ a0P8rvhVlJ:(UIButton*) a0P8rvhVlJ aYEH9:(UIControlEvents*) aYEH9 aYjhtsV:(UITableView*) aYjhtsV aODSQqItc4:(UIActivity*) aODSQqItc4 aQC6zXO:(UIImageView*) aQC6zXO a56CrDOd:(UIFontWeight*) a56CrDOd {
  241. NSLog(@"8ExIYJTK9dsW4qXaczO175Un0ewuPlCL");
  242. NSLog(@"i0sovxU8JGwlQugPCmjAHVYZ3LhzF6R5");
  243. NSLog(@"hLHjYMoaP972KZNzTwApI");
  244. NSLog(@"DGYrxtkL2aKbU3I4iczuOnySmp9s8EqNVX7f6Jvd");
  245. NSLog(@"3gMt4e9XITEfwhZauVCFm20dJznGrbyiN1oQcq");
  246. NSLog(@"Xx8gGnaF3ywiNDzjHtQVbBYf");
  247. NSLog(@"NlVJyhUIjFCndwrZ7kO0gs");
  248. NSLog(@"VPzTWnLcxAuN1l9rvk");
  249. NSLog(@"JAjgdHfQ28BhiapEbcPZNFG4ToMCOySLz7rYRn");
  250. NSLog(@"Cfu3vZUatRqjpYwmQSb96cENJWnrDM14lzFV5");
  251. NSLog(@"QCYrv7HdMKJcaXZmhVpoOBb");
  252. NSLog(@"jxdpUv57sFHCmTRAle32yQVO0I");
  253. NSLog(@"4YK6Q8pNMy2HxjUaf");
  254. NSLog(@"RYaI1CkLcy3nrmMWVX");
  255. }
  256. -(void)ai9TFvgb:(UIBezierPath*) ai9TFvgb a1fCkF:(UIBarButtonItem*) a1fCkF akGiYfPsmC:(UIFontWeight*) akGiYfPsmC a6GbJQPKseL:(UIImage*) a6GbJQPKseL aPuHwrTFB:(UITableView*) aPuHwrTFB aPGABs:(UIMenuItem*) aPGABs {
  257. NSLog(@"fgay9YoZA4su3hDeLC7x");
  258. NSLog(@"4wpYo76aPXzy");
  259. NSLog(@"jbJ4ILS16gUncGuRQZaht0TiAP9XkCFeqMdB");
  260. NSLog(@"J6dEVaTUu3O");
  261. NSLog(@"rFMfdSvcmiZ4EHeOgbYjTKkuCGAhXxo3");
  262. NSLog(@"KIPWzVc4GuafpnmU");
  263. NSLog(@"z17Z3dQigKb4RNkOT");
  264. NSLog(@"rn0aIJwSm729bgozXOWUqTtl");
  265. NSLog(@"wVH04XURIWskC8LqmAKOPSFrug");
  266. NSLog(@"cd7Nl9aPDvM0geOKzqmIYZTh");
  267. NSLog(@"4azWoDvR0Qi");
  268. NSLog(@"3A0KDrBHXtSloT4ghdZs7vfJQL");
  269. NSLog(@"IOZ5kojJRHgfF");
  270. }
  271. -(void)aCvgUS0k:(UIBarButtonItem*) aCvgUS0k abOhG1iZ:(UILabel*) abOhG1iZ aeGz1D3:(UIImageView*) aeGz1D3 axRfk:(UITableView*) axRfk afyiugQIlo:(UIMenuItem*) afyiugQIlo aVEhjXon:(UIControlEvents*) aVEhjXon aCkpvm5F:(UIActivity*) aCkpvm5F aWIbTaS0:(UIMenuItem*) aWIbTaS0 acTID:(UIRegion*) acTID a71TDj924Z:(UIBarButtonItem*) a71TDj924Z a0cy36:(UISwitch*) a0cy36 aI0ReG1BU:(UIView*) aI0ReG1BU ap6XdYQiGB:(UIWindow*) ap6XdYQiGB a93IHaRz:(UIActivity*) a93IHaRz a1JfBbNH:(UIFont*) a1JfBbNH aRQAVH:(UIMotionEffect*) aRQAVH aehNy:(UILabel*) aehNy auOIrdBp:(UIRegion*) auOIrdBp amnKM:(UIColor*) amnKM {
  272. NSLog(@"0UyfeJc9Zap3");
  273. NSLog(@"WoAQr7tBS9vj68YuyqEJTkFI04bU3C2RpK");
  274. NSLog(@"O5KQ1XcdL0EICv7ThJtHuWx4BFbqfsGyZ2zn3p");
  275. NSLog(@"mkhtn2NwOABPxCs0vd");
  276. NSLog(@"aS7k0ors2D");
  277. NSLog(@"TOXtJajyf0V");
  278. NSLog(@"blzYP1VyJoMWG4");
  279. NSLog(@"H7keUsxQ8hzGa6vT0PR");
  280. NSLog(@"a3heO1oKZNm");
  281. NSLog(@"3EonFwc8rCthjQKV7xaYIpud6XMZLJUl");
  282. NSLog(@"HM8pd1VClJ0bj3na9s");
  283. NSLog(@"DbEgVMzfZWKy7Rwvth1QOpuaSIoY940mlH8FTr");
  284. NSLog(@"H7FedBNPzEKpmiUDvV1rcT3x0SjyQlY9");
  285. NSLog(@"WM8c5JXYi04HNeVhOxSUDa");
  286. NSLog(@"0THcprOe74EtndgDPARzQbG");
  287. NSLog(@"UEZD3CklGjKHheoSTapwW9cAPzvbQq1");
  288. }
  289. -(void)aE65Jrl:(UIEdgeInsets*) aE65Jrl aGsqr:(UIControl*) aGsqr a0UES:(UIBarButtonItem*) a0UES aKOmX59p:(UIFontWeight*) aKOmX59p aLTsi:(UIActivity*) aLTsi axRmUT4hYD3:(UIDocument*) axRmUT4hYD3 aj8TnaC:(UITableView*) aj8TnaC aHJ4eu:(UIInputView*) aHJ4eu {
  290. NSLog(@"zodQTYZbgswa5R");
  291. NSLog(@"bR1hicYDtBF3TOuIWNd2ngx9HKXA4GylqV");
  292. NSLog(@"Qz3VbWqNxPRZdft");
  293. NSLog(@"t6JaQuWy75bFCdBxkqY09fg3NcVLTSziPD");
  294. NSLog(@"CpdirnG3FZUBMNuV");
  295. NSLog(@"efgEbGUmDpw82i1OPrTVoXxyA3I5lWZqK");
  296. NSLog(@"CXwu2nKQVsFmRJfM07");
  297. NSLog(@"7oJIb1ZtzwDfSmsAjyr24TgOq");
  298. NSLog(@"Uw5x17as8ASpi6VMIjGPyYRbkonLNXd");
  299. NSLog(@"Dtjc3VgBNw5");
  300. NSLog(@"hcMxuozDr2V1dERyO8tYpeKSmNUG");
  301. NSLog(@"wGokDI8Z9CBes2NFvPXlp4xi");
  302. }
  303. @end