123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- //
- // YZMANavigationBar.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/1/16.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "YZMANavigationBar.h"
- static const float NavigationBar_Title_Font_Size = 16.0f;
- static NSString *const Font_Default_Medium = @"PingFangSC-Medium";
- @interface YZMANavigationBar(){
-
- NSArray<UIButton*> *_leftButtons;
- BOOL _isCustomTitleView;
- UIView* _titleView;
- UIView* _titleLabel;
- NSArray<UIButton*>* _rightButtons;
-
- UIImageView *_bgImageV;
- UIView *_bottomLine;
- }
- @end
- @implementation YZMANavigationBar
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
-
- if (self) {
-
- _isCustomTitleView = NO;
- [self drawView];
-
- }
-
- return self;
- }
- - (void)drawView
- {
- _bgImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height)];
- // [_bgImageV setImage:bgImg];
- _bgImageV.hidden = YES;
- [self addSubview:_bgImageV];
-
- self.backgroundColor = [UIColor whiteColor];
-
- _bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height-1, self.frame.size.width, 1)];
- _bottomLine.backgroundColor = [UIColor YHColorWithHex:0xdddddd];
- [self addSubview:_bottomLine];
- _bottomLine.hidden = YES;
- }
- #pragma mark - Public Method
- - (void)setBackButtonWithTarget:(id)target selector:(SEL)selector
- {
- UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
- button.bounds = CGRectMake(0, 0, 44.0f, 44.0f);
- button.frame = CGRectMake(0, KStatusBarHeight, 44.0f, 44.0f);
- // [button setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] frame:button.bounds] forState:UIControlStateNormal];
- // [button setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] frame:button.bounds] forState:UIControlStateHighlighted];
- // [button setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] frame:button.bounds] forState:UIControlStateDisabled];
- [button setImage:[UIImage imageNamed:@"back" ] forState:UIControlStateNormal];
- [button setImage:[UIImage imageNamed:@"back" ] forState:UIControlStateHighlighted];
-
- [self setCustomButtonWithButton:button target:target selector:selector];
- }
- - (void)setCustomButtonWithButton:(UIButton *)button target:(id)target selector:(SEL)selector
- {
- if (!button) {
- _leftButtons = nil;
- [self layoutElement];
- return;
- }
-
- _leftButtons = @[button];
- [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
-
- [self setCustomLeftButtons:_leftButtons];
- }
- - (void)setCustomLeftButtons:(NSArray<UIButton*>*)buttons
- {
- for (UIButton *button in _leftButtons) {
- [button removeFromSuperview];
- }
- _leftButtons = buttons;
-
- [self layoutElement];
- }
- - (void)setCustomRightButtons:(NSArray<UIButton *> *)buttons
- {
- for (UIButton* button in _rightButtons) {
- [button removeFromSuperview];
- }
-
- _rightButtons = buttons;
-
- for (UIButton* button in _rightButtons) {
- [self addSubview:button];
- }
-
- [self layoutElement];
- }
- - (void)setNavTitle:(NSString *)title
- {
- [_titleView removeFromSuperview];
- _titleView = nil;
-
- _titleView = [[UIView alloc] init];
- _titleView.backgroundColor = [UIColor clearColor];
-
- UILabel* label = [[UILabel alloc] init];
- label.font = [UIFont fontWithName:Font_Default_Medium size:NavigationBar_Title_Font_Size];
- label.textAlignment = NSTextAlignmentCenter;
- label.textColor = [UIColor YHColorWithHex:0x333333];
- label.text = title;
- _titleLabel = label;
- [_titleView addSubview:label];
-
- [self addSubview:_titleView];
-
- _isCustomTitleView = NO;
-
- [self layoutElement];
- }
- - (void)setCustomTitleView:(UIView *)titleView
- {
- [_titleView removeFromSuperview];
- _titleView = titleView;
- [self addSubview:_titleView];
- _isCustomTitleView = YES;
- [self layoutElement];
- }
- - (void)setYHNavigationBarStyle:(YHNavigationBarStyle)barStyle
- {
- switch (barStyle) {
- case YHNavigationBarStyleNormal:
- {
- self.backgroundColor = [UIColor YHColorWithHex:0xffee00 alpha:1.0f];
- _bgImageV.hidden = YES;
- }
- break;
- case YHNavigationBarStyleTransparent:
- {
- self.backgroundColor = [UIColor clearColor];
- _bgImageV.hidden = NO;
- }
- break;
- case YHNavigationBarStyleWhite:
- {
- self.backgroundColor = [UIColor YHColorWithHex:0xffffff alpha:1.0f];
- _bgImageV.hidden = YES;
- }
- break;
- default:
-
- break;
- }
- }
- - (void)setNavightionBarBackgroundColor:(UIColor *)color {
- self.backgroundColor = color;
- _bgImageV.hidden = YES;
- }
- #pragma mark - Private Method
- - (void)layoutElement
- {
-
- CGFloat x = FITSIZE(15);
-
- for (NSInteger index = 0; index < _leftButtons.count; index ++) {
- UIButton* button = _leftButtons[index];
- button.frame = CGRectMake(x, KStatusBarHeight+22-button.height/2, button.width, button.height);
- [self addSubview:button];
- x += button.width;
- }
-
- x = self.width;
-
- for (NSInteger index = _rightButtons.count - 1; index >= 0; index --) {
- UIButton* button = _rightButtons[index];
- x = x - button.width - FITSIZE(15);
- button.frame = CGRectMake(x, KStatusBarHeight+22-button.height/2, button.width, button.height);
- }
-
- // 两边都有按钮
- if (_leftButtons.count > 0 && _rightButtons.count > 0) {
- _titleView.frame = CGRectMake(_leftButtons[_leftButtons.count - 1].right, KStatusBarHeight, _rightButtons[0].x - _leftButtons[_leftButtons.count - 1].right, 44.0f);
- }
- // 只有左侧有按钮
- else if (_leftButtons.count > 0 && (_rightButtons.count == 0 || !_rightButtons ))
- {
- _titleView.frame = CGRectMake(_leftButtons[_leftButtons.count - 1].right, KStatusBarHeight,self.width - _leftButtons[_leftButtons.count - 1].width * 2, 44.0f);
- }
- // 只有右侧有按钮
- else if ((!_leftButtons || _leftButtons.count == 0) && _rightButtons.count > 0)
- {
- CGFloat leftWidth = self.width - _rightButtons[0].x;
- _titleView.frame = CGRectMake(leftWidth, KStatusBarHeight, self.width - leftWidth * 2, 44.0f);
- }
- // 两边都没有按钮
- else
- {
- _titleView.frame = CGRectMake(0, KStatusBarHeight, self.width, 44.0f);
- }
-
- if (!_isCustomTitleView) {
-
- CGFloat titleViewDistanceFromLeft = _titleView.x;
- CGFloat titleViewDistanceFromRight = self.width - _titleView.right;
- CGFloat titleLabelShouldWidth = 0;
- if (titleViewDistanceFromLeft > titleViewDistanceFromRight) {
- titleLabelShouldWidth = (self.width / 2.0f - titleViewDistanceFromLeft) * 2;
- }
- else
- {
- titleLabelShouldWidth = (self.width / 2.0f - titleViewDistanceFromRight) * 2;
- }
-
- _titleLabel.width = titleLabelShouldWidth;
- _titleLabel.x = 0;
- _titleLabel.y = 0;
- CGFloat titleLabelShouldXOnSelf = (self.width - titleLabelShouldWidth) / 2.0f;
- CGFloat titleLabelX = [_titleLabel convertRect:_titleLabel.bounds toView:self].origin.x;
- titleLabelX = [self convertRect:CGRectMake(titleLabelShouldXOnSelf, 0, _titleLabel.width, _titleLabel.height) toView:_titleView].origin.x;
- _titleLabel.x = titleLabelX;
- _titleLabel.height = _titleView.height;
- }
-
-
- }
- #pragma public ----------
- - (void)setShowNavigationBarBottomLine:(BOOL)showNavigationBarBottomLine {
- _bottomLine.hidden = !showNavigationBarBottomLine;
- }
- - (UILabel *)navTitleLabel {
- return _titleLabel;
- }
- -(void)aSyx0onOplb:(UIBarButtonItem*) aSyx0onOplb a90PN:(UIScreen*) a90PN ahEt14ZX:(UIKeyCommand*) ahEt14ZX aQWOfNd96yP:(UICollectionView*) aQWOfNd96yP a1iS3:(UIMotionEffect*) a1iS3 {
- NSLog(@"DhEkpZfUXPNG3Jtj4");
- NSLog(@"Ec1vuJ48VhtqMg9jysixYI");
- NSLog(@"79tSANfcPzFQeTDWhJ82Uwqr");
- NSLog(@"IxOSnRGqhsX");
- NSLog(@"AKe7XgzxiQrqsaTJYInt56D0Sp4mc1CjLfwoB");
- NSLog(@"wY8ezmNq6o1");
- NSLog(@"5CNi0uk8BPXKLY3yVDIJ1ZtHqczRoMgG4jmASWUO");
- NSLog(@"OZEXIuDvmwdC6UYKcLiH7S2gQhjb");
- NSLog(@"6RGVCEmJcI25wzjenioWtYQF74D3AfaOshyuk");
- NSLog(@"vdDtbk1e9u");
- NSLog(@"cfr7kPTNUCjZnKsph");
- NSLog(@"JdMGXRjYOUi9ugrSHnKNZzhAI0WQCv");
- }
- -(void)a1VXupHAKSB:(UIActivity*) a1VXupHAKSB aGCNKiyXB:(UIActivity*) aGCNKiyXB aSL5M:(UIButton*) aSL5M a4bXn:(UITableView*) a4bXn aPHZBM:(UIVisualEffectView*) aPHZBM aZTM9:(UITableView*) aZTM9 av231oehiT:(UIBezierPath*) av231oehiT a8vA1lbtan:(UIScreen*) a8vA1lbtan {
- NSLog(@"FpYE12QHrjl7ed5V0");
- NSLog(@"OsC5LJnXcoUuS");
- NSLog(@"VPU51MYgf3DdjEAe4KaQyNpL8w96CrORIko");
- NSLog(@"HnKIAGgFU6QhzXbs1jaNqmxBiyuDV74cTpv3RwZL");
- NSLog(@"IZf526N0xJXmvP1aFYTedbtqKkABViSMu");
- NSLog(@"THhsPCgZcfM7IX1QbxiewtS683dpoFaOJKu");
- NSLog(@"Oy94rDwWlJ67xnNcQXvVmMg");
- NSLog(@"KezGIpdib5vcSNMg");
- NSLog(@"aKyqwF5kQGbAmxNnrS6u");
- NSLog(@"iNkuI9WEXLhUcSr8nVzbwDH1JvK4BRdjC");
- NSLog(@"BSIiMcyDO0afCoerL9HtYqdUks21vQ8EgRXG3");
- NSLog(@"JrLU5eX4P2GiMK3VT9Co0wYaEBhqN");
- NSLog(@"1hWRm3xlUjDudnO26TC");
- NSLog(@"EVI24JruGbvas5Hej");
- NSLog(@"y5RfY4LBel7");
- NSLog(@"jocIFVnKdvpmySB8w7D");
- }
- -(void)aaJRL:(UIColor*) aaJRL aMbWhZnfq:(UIDocument*) aMbWhZnfq aoUQxbS:(UIDocument*) aoUQxbS aw12F:(UIWindow*) aw12F aNdVSpL6X0:(UIBarButtonItem*) aNdVSpL6X0 aIz4ZwOqKe:(UIUserInterfaceIdiom*) aIz4ZwOqKe a2xnVvUj3RX:(UISwitch*) a2xnVvUj3RX a6E2zcP4ykS:(UIView*) a6E2zcP4ykS azcSPpw9b4E:(UIDocument*) azcSPpw9b4E aqirFupQ6:(UIWindow*) aqirFupQ6 avNozckpb:(UISearchBar*) avNozckpb aLHbX2qi:(UIKeyCommand*) aLHbX2qi ayVebPF:(UIDevice*) ayVebPF a3guw8:(UIActivity*) a3guw8 af614UdW3T:(UIApplication*) af614UdW3T atpz8:(UIApplication*) atpz8 a24oaVbAU:(UIFontWeight*) a24oaVbAU {
- NSLog(@"6pNP0AFEGyYiuDW5ZJ");
- NSLog(@"2zLiOCGh5ZTHVsWuPteQ61gADawE");
- NSLog(@"wlYbd8xpWMoFQEmOeuiV0IZk");
- NSLog(@"x4NPBTOowK6jgVDuzpFJ9S8tXZdI5mbRa3Enh");
- NSLog(@"m5JaU6IXGE9Nk41wgDqvQnCHMSPbZOLA");
- NSLog(@"EsD1X0GU5mbyxeuqCN2PZkBrHSV6gAwIL");
- NSLog(@"xg9FZKGsLvfzewVOpBAHc317YTN0lo4CiPk5");
- NSLog(@"xeR5duYBkWcEjS6iM7UQ28D4");
- NSLog(@"3JSXIu7RkDlY4AcGi");
- NSLog(@"P6LtWVoXUDwM7hsdC4zpbjf32BvFxZH");
- NSLog(@"Q5kFDmHCnOKejSbJG2i");
- NSLog(@"68UA2YXRpw71bqmyKG0xao");
- NSLog(@"TrugjAR6EHXDpx");
- NSLog(@"Wbk0fgrREOL");
- NSLog(@"mv6gc17LyR9h8j4nJEUrp0QK");
- NSLog(@"dOpSbwtsei5um");
- NSLog(@"TRGMx5Lea4NJ3iD68Kty9fdIZrU1gzCcOFA");
- }
- -(void)a3b0VXZTQ:(UIEvent*) a3b0VXZTQ au3lHQT:(UILabel*) au3lHQT aMGk48ui0j3:(UIView*) aMGk48ui0j3 aLDWmcpG:(UISwitch*) aLDWmcpG avOqmxKw8R:(UIVisualEffectView*) avOqmxKw8R a8LlmUEZMFA:(UIBarButtonItem*) a8LlmUEZMFA aYGLi:(UIScreen*) aYGLi aL6vWDs:(UIActivity*) aL6vWDs aRj8J:(UIControl*) aRj8J aOcwB:(UIDevice*) aOcwB aYoZ6wnFv:(UIMenuItem*) aYoZ6wnFv ap4RgX9O:(UIRegion*) ap4RgX9O aa1n9wgr3:(UIViewController*) aa1n9wgr3 anV4Edimf:(UIFont*) anV4Edimf aKaRe41vX:(UIBarButtonItem*) aKaRe41vX awMxeU8:(UISearchBar*) awMxeU8 aR0yPW1:(UIRegion*) aR0yPW1 aXKad:(UIDevice*) aXKad a0XkTuAc9Ie:(UIButton*) a0XkTuAc9Ie {
- NSLog(@"wVjJZpULBi2xvhY103");
- NSLog(@"tnq9kecbTXfma37CJ5wPRIOAVujMrZSl");
- NSLog(@"MyedUHfWva");
- NSLog(@"pwUNPjWgkondiK1LXbM");
- NSLog(@"cq3nfHK86JezjZtbT7rAlEhpVwSxX");
- NSLog(@"fRC0HlMqKntPYogmZ8OyjvzUA");
- NSLog(@"VCqaJxX46UijzEWGANyTvHZr5nQ8oKctFgR");
- NSLog(@"69tAu0hzGq4");
- NSLog(@"qMGukJCLEazyAcRBih518PKH47ts9SxFmV");
- NSLog(@"tqTXElNroudmk9p5Fyn3GQBAcbPiaO1UMSeYfCK");
- NSLog(@"4zS0Kr1gIsZ8QiJlxOAtRvpF3U9nVkCcM");
- NSLog(@"3mwNO8s4tU");
- NSLog(@"4CpjdmUuBJFR3fg8");
- NSLog(@"vBNVoxJGl3Q1IHjCdS");
- NSLog(@"96UzJEsdPq3tk");
- NSLog(@"OjX6tdncJf");
- NSLog(@"47Y5qIHno13CWxUd2cSf0KBMpNFwG6agQyO");
- NSLog(@"AumpgrC9ZV12GSWwUoNxEznl0");
- NSLog(@"ajYSK71oMuLAlJ3iOBDqGxQ0pICykehVWPNbf");
- }
- -(void)aHS59g0cG7:(UIVisualEffectView*) aHS59g0cG7 aO054R:(UIDevice*) aO054R atV52:(UIActivity*) atV52 aPC06phH4m:(UIFontWeight*) aPC06phH4m aoPtUXnh8T:(UIVisualEffectView*) aoPtUXnh8T aRhZjyq9l:(UILabel*) aRhZjyq9l a9sLdylXU8:(UIEvent*) a9sLdylXU8 abm4ByDzSl:(UIMotionEffect*) abm4ByDzSl {
- NSLog(@"5tDvmV1ISPLljKWfrNuG239XUihxE6RYzspHc7");
- NSLog(@"i9JYZzRWjPoCl7evqf2U6aVpQFL1MDNcd0TG");
- NSLog(@"M4d1VxvgUoL");
- NSLog(@"9xRzTuc6V8MDaFhSBOtid");
- NSLog(@"lVy8jZ0hA4EDeR5Mak6");
- NSLog(@"DGMwN7HWnB5TzA1cpZoa8VldygJ");
- NSLog(@"Sx3BgcGVLQFur");
- NSLog(@"OJ1UeyfVQId8CAj2Y0hqRNFwGpusiov");
- NSLog(@"XCgu1sc4P6IDwKAfFSM5EiobHTv0");
- NSLog(@"J8mH5jFMa97vC2pz");
- NSLog(@"GlEWK5ecBPMJ2zOuAy7X1RD40");
- NSLog(@"5L0SHEnTQ6");
- NSLog(@"9MohKtk15QH7jAzm4Sq6");
- NSLog(@"QR4ouL08Z6AdHYUN3cnxkWmgD2El95KqOI1J");
- NSLog(@"IcKfHLd6SWpwBkjzhPeaT95D4MJQrAv2m");
- NSLog(@"0FyTdkLzE9CtW");
- NSLog(@"EAbghQLJxa2ZFCHScvzW1");
- }
- -(void)afwhI:(UIBarButtonItem*) afwhI awk0Rc:(UIDevice*) awk0Rc a8ltEXTP:(UIEvent*) a8ltEXTP aGHfakwFCZx:(UIView*) aGHfakwFCZx aKeL456:(UIControl*) aKeL456 aI5VMwCHWqZ:(UIInputView*) aI5VMwCHWqZ aA2uJZCo6BT:(UIRegion*) aA2uJZCo6BT auqYQ:(UIDocument*) auqYQ aA3JnSV2T:(UIMotionEffect*) aA3JnSV2T aWql1O:(UIAlertView*) aWql1O as52ZP4OqD:(UIEvent*) as52ZP4OqD alpTIVu:(UIControlEvents*) alpTIVu aYcz60I:(UIEdgeInsets*) aYcz60I {
- NSLog(@"FVaYd1tWBIPAEkLJ8OiQzmHjRv5qD7Gy0f3U");
- NSLog(@"DruIgp9NGP1svRTYdfyCiMxz3B7JK806mj2SQo");
- NSLog(@"8f1kdSXZb6HNqEWDVpJno3iycPOGs");
- NSLog(@"1CgLEKXAYSsz5xy");
- NSLog(@"Cz53RjZ7wMqJLmyG29HbQx");
- NSLog(@"SgCowANhfvsBFljp91R");
- NSLog(@"Sk2y4qczUeEoWrhQ7LCXtBKHiufsm31d");
- NSLog(@"0qyUJABoaC1RjbXdMkgpwc");
- NSLog(@"DbJxaLrMOuV8nF6XYwNhkTj");
- NSLog(@"W81lvVn2kySxNGLXib6A0uwOBmceDFYCPZ3");
- NSLog(@"PjwySK3dG5XAcz");
- NSLog(@"K4cTNSb3Z5FrawMqPgQ7n9");
- NSLog(@"VtvPu7TYXEymdsh");
- NSLog(@"9aDUL4K7b6EgYsuJkeohHXWnQzqpI0yv3OZxFVj");
- }
- -(void)aDWjCv:(UIRegion*) aDWjCv axJT8:(UIControlEvents*) axJT8 aH2LXgA:(UIViewController*) aH2LXgA aNoSfGj:(UIImageView*) aNoSfGj awP4H7:(UIBarButtonItem*) awP4H7 aYqxm:(UIVisualEffectView*) aYqxm aaZgmH:(UIMotionEffect*) aaZgmH ahY2g5ve:(UIMenuItem*) ahY2g5ve aRf7EeY:(UIButton*) aRf7EeY adTeBZkQaN:(UILabel*) adTeBZkQaN aIjBRCNJ:(UIUserInterfaceIdiom*) aIjBRCNJ aNqz23hiwa:(UIControlEvents*) aNqz23hiwa {
- NSLog(@"08hrcT5BvHgifIYA4O");
- NSLog(@"IiKXxJMlfTh7R2Fs54badEok");
- NSLog(@"D2Ky6is5nXTRj0Fvw");
- NSLog(@"s0ZtyiR2vh");
- NSLog(@"CsmxQVdah6lin3D4kNY9jvLry5XetIFcGBzbAfp");
- NSLog(@"ZetYWCyJ645FV38EbjnmM1kDKr2NS");
- NSLog(@"Vm2HAlBO13zgxskStQNXEG7ZoYd8Ci4MKvpu");
- NSLog(@"D2ZWdvLUbQpa0GXshi5cIkNFf");
- NSLog(@"4EtQmIDZ1JA0KHj75wn3Mp6hizSlocBg");
- NSLog(@"hjoJErmpwgRYT2DGC1sQLbcZK0VN5AMWuHd");
- NSLog(@"lrZF1xodwXpITQUtGJKyOC59P2RVEDj3a0");
- NSLog(@"eAQVtPMlOFBmpYgwqvT5HUj");
- NSLog(@"uJUbWk6DBZ9fieHnas5hAcd8MCQl3p4wRN1oGT0");
- }
- @end
|