Commit 78957ca0 authored by jinzhu's avatar jinzhu

外漏 OCNavigationBar 间距

parent 1ce940fd
......@@ -14,7 +14,7 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- GMBase (0.4.3):
- GMBase (0.4.4):
- GMHud
- GMJSONModel
- GMKit
......@@ -103,7 +103,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
GMBase: 11e3302fcb7fc304469fc7e123f6961c318b7793
GMBase: f4e70f9df40fe5bf714ad46f9417466d4be060a4
GMCache: b7d48432ee2469eb0c6c86c720a1958bd373187e
GMHud: 9cc3942fc9f215db55b134cbfd05a458b124a964
GMJSONModel: 5e81a98de668e9f93cf6ff77869f77b0d1a806be
......
......@@ -36,6 +36,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong, readonly) OCNavigationBarButton *rightButton;
@property (nonatomic, strong, readonly) OCNavigationBarButton *nearRightButton;
/**
* 设置导航栏 leftButton rightButton nearRightButton 外间距(目前来看这三个间距应该是一样的 如果不一样可以找设计协商)
* 间距 主要用作button带一个圆形背景导航栏渐变默认统一为10
*/
@property (nonatomic, assign) CGFloat buttonMargin;
/**
leftIcon 有默认值:back
*/
......
......@@ -30,6 +30,7 @@
- (void)awakeFromNib{
[super awakeFromNib];
_buttonMargin = 20;
[self setup];
}
......@@ -37,7 +38,7 @@
self.clipsToBounds = NO;
self.backgroundColor = [UIColor whiteColor];
[self addNavigationShadow];
_itemView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44)];
CGFloat titleW = [UIScreen mainScreen].bounds.size.width - 80;
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, titleW, 44)];
......@@ -67,19 +68,23 @@
[_itemView addSubview:_leftButton];
[_itemView addSubview:_rightButton];
[_itemView addSubview:_nearRightButton];
[_itemView mas_makeConstraints:^(MASConstraintMaker *make) {
[self updateButtonsConstraints];
}
- (void)updateButtonsConstraints {
[_itemView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(0);
make.height.mas_equalTo(44);
}];
[_leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
[_leftButton mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(20);
make.centerY.mas_equalTo(0);
}];
[_rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
[_rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-20);
make.centerY.mas_equalTo(0);
}];
[_nearRightButton mas_makeConstraints:^(MASConstraintMaker *make) {
[_nearRightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(_rightButton.mas_left).offset(-20);
make.centerY.mas_equalTo(0);
}];
......@@ -225,6 +230,11 @@
[self layoutTitle];
}
- (void)setButtonMargin:(CGFloat)buttonMargin {
_buttonMargin = buttonMargin;
[self updateButtonsConstraints];
}
@end
@implementation OCNavigationBar (ViewConstant)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment