Commit ea5e0443 authored by 汪洋's avatar 汪洋

优化导航栏标题过长时的显示

parent 4bdef917
......@@ -25,8 +25,10 @@
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"%@", self.referer);
self.navigationBar.title = @"列表";
self.navigationBar.rightTitle = @"没什么用";
self.navigationBar.title = @"你好我是汪洋,我在更美工作,很开心,哈哈哈哈哈哈";
// self.navigationBar.rightTitle = @"举报有奖";
self.navigationBar.nearRightIcon = @"back";
self.navigationBar.rightIcon = @"back";
_table.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
[_table registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
}
......
......@@ -19,7 +19,7 @@
{
[super viewDidLoad];
self.pageName = @"yw";
self.title = @"你好";
self.title = @"你好我是汪洋,我在更美工作,很开心,哈哈哈哈哈哈";
}
......
......@@ -84,6 +84,11 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
......
......@@ -4,7 +4,7 @@ platform :ios, '8.0'
#open source
source 'https://github.com/CocoaPods/Specs.git'
#our company
source 'git@git.gengmei.cc:gengmeiios/GMSpecs.git'
source 'git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git'
target 'GMBase_Example' do
pod 'GMBase', :path => '../'
......
......@@ -14,7 +14,7 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- GMBase (0.2.2):
- GMBase (0.3.0):
- GMHud
- GMKit
- GMNetService
......@@ -88,7 +88,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
GMBase: 4b5007e5bf6de3ffd54c2ce132ac7fa58b8c7a52
GMBase: 1654a1e7146647d619e536f3ecb97e6a37b83f91
GMCache: fb0af70b420715ef9519487fdd932a357b3cd8d4
GMHud: 74387462a8b9f099c760a1ddbf493cc86da7cdbc
GMKit: 4820e0eb7727735f88fb2f983f178edd074343c1
......@@ -103,6 +103,6 @@ SPEC CHECKSUMS:
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
UITableView+FDTemplateLayoutCell: 234e1582bcc4e18461af91155123bb96538ed030
PODFILE CHECKSUM: 0c80e9302d494ed154da93823382c933df985f69
PODFILE CHECKSUM: b9c24bb8fb1ea50b58c59e079b456b4ca1d9b998
COCOAPODS: 1.3.1
......@@ -45,8 +45,8 @@
make.height.offset(1/[UIScreen mainScreen].scale);
}];
_itemView = [[UIView alloc] initWithFrame:CGRectMake(0, [UIApplication sharedApplication].statusBarFrame.size.height, [UIScreen mainScreen].bounds.size.width, 44)];
CGFloat titleW = [UIScreen mainScreen].bounds.size.width - 80;
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, titleW, 44)];
CGFloat titleW = [UIScreen mainScreen].bounds.size.width - 50 - 50;
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 0, titleW, 44)];
_titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
_titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_titleLabel.textAlignment = NSTextAlignmentCenter;
......@@ -95,6 +95,19 @@
button.adaptiveWidth = 40;
}
- (void)layoutSubviews {
[super layoutSubviews];
if (_nearRightIcon || _nearRightTitle) {
_titleLabel.frame = CGRectMake(80, 0, self.width - 160, 44);
return;
}
if (_rightTitle.length >= 3) {
_titleLabel.frame = CGRectMake(80, 0, self.width - 160, 44);
}
}
#pragma mark - Public
- (void)showShadow:(BOOL)show {
_shadowView.hidden = !show;
......@@ -166,6 +179,7 @@
_rightButton.hidden = NO;
[_rightButton setImage:nil forState:UIControlStateNormal];
[_rightButton setTitle:_rightTitle forState:UIControlStateNormal];
}
- (void)setNearRightIcon:(NSString *)nearRightIcon {
......
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