Skip to content

Commit

Permalink
[Releases 1.7.0] 移除标题文字支持换行
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsic committed Dec 22, 2020
1 parent f30102d commit 582edde
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 248 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ SGPageContentCollectionView(内部由 UICollectionView 实现)


## Installation
* 1、CocoaPods 导入 pod 'SGPagingView', '~> 1.6.9'
* 1、CocoaPods 导入 pod 'SGPagingView', '~> 1.7.0'
* 2、下载、拖拽 “SGPagingView” 文件夹到工程中


Expand Down Expand Up @@ -182,6 +182,8 @@ b. 实现 SGPageContentScrollView 的 pageContentScrollView:index:代理方法

* 2020-11-01 :v1.6.9 Badge 新增配置属性,支持网络图片,修复无指示器滚动内容视图时标题文字不切换

* 2020-12-22 :v1.7.0 标题不支持换行(极端情况出现的标题换行效果)


## License
SGPagingView is released under the MIT license. See [LICENSE](https://github.com/kingsic/SGPagingView/blob/master/LICENSE) for details.
2 changes: 1 addition & 1 deletion SGPagingView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'SGPagingView'
s.version = '1.6.9'
s.version = '1.7.0'
s.summary = 'A powerful and easy to use segment view'
s.homepage = 'https://github.com/kingsic/SGPagingView'
s.license = 'MIT'
Expand Down
2 changes: 0 additions & 2 deletions SGPagingView/SGPageTitle/SGPageTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,6 @@ - (void)setupTitleButtons {
SGPageTitleButton *btn = [[SGPageTitleButton alloc] init];
btn.tag = index;
btn.titleLabel.font = self.configure.titleFont;
btn.titleLabel.textAlignment = NSTextAlignmentCenter;
btn.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
[btn setTitle:self.titleArr[index] forState:(UIControlStateNormal)];
[btn setTitleColor:self.configure.titleColor forState:(UIControlStateNormal)];
[btn setTitleColor:self.configure.titleSelectedColor forState:(UIControlStateSelected)];
Expand Down
2 changes: 1 addition & 1 deletion SGPagingView/SGPagingView.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// SGPagingView.h
// Version 1.6.9
// Version 1.7.0
// GitHub:https://github.com/kingsic/SGPagingView
//
// Created by kingsic on 2016/10/6.
Expand Down
6 changes: 0 additions & 6 deletions SGPagingViewExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
8D5BB745213AC303000E929E /* ChildTempPopGestureVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D5BB744213AC303000E929E /* ChildTempPopGestureVC.m */; };
8D5BB749213AC570000E929E /* SGPagingViewPopGestureVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D5BB747213AC570000E929E /* SGPagingViewPopGestureVC.m */; };
8D5E68CF20F2FA140068044C /* DefaultAnimatedVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D5E68CE20F2FA140068044C /* DefaultAnimatedVC.m */; };
8D69372622EC1E0200F91864 /* DefaultTopBottomVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D69372522EC1E0200F91864 /* DefaultTopBottomVC.m */; };
8DA4304120BBE3D600C47917 /* SGPageContentCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA4303F20BBE3D500C47917 /* SGPageContentCollectionView.m */; };
8DA4304420BBEDEC00C47917 /* UIButton+SGPagingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA4304320BBEDEC00C47917 /* UIButton+SGPagingView.m */; };
8DA4304720BBEF3B00C47917 /* DefaultImageVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA4304620BBEF3B00C47917 /* DefaultImageVC.m */; };
Expand Down Expand Up @@ -169,8 +168,6 @@
8D5BB748213AC570000E929E /* SGPagingViewPopGestureVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPagingViewPopGestureVC.h; sourceTree = "<group>"; };
8D5E68CD20F2FA140068044C /* DefaultAnimatedVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DefaultAnimatedVC.h; sourceTree = "<group>"; };
8D5E68CE20F2FA140068044C /* DefaultAnimatedVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DefaultAnimatedVC.m; sourceTree = "<group>"; };
8D69372422EC1E0200F91864 /* DefaultTopBottomVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DefaultTopBottomVC.h; sourceTree = "<group>"; };
8D69372522EC1E0200F91864 /* DefaultTopBottomVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DefaultTopBottomVC.m; sourceTree = "<group>"; };
8DA4303F20BBE3D500C47917 /* SGPageContentCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGPageContentCollectionView.m; sourceTree = "<group>"; };
8DA4304020BBE3D600C47917 /* SGPageContentCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGPageContentCollectionView.h; sourceTree = "<group>"; };
8DA4304220BBEDEC00C47917 /* UIButton+SGPagingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIButton+SGPagingView.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -359,8 +356,6 @@
8DF628F620A94CBA00B7B85A /* DefaultSystemVC.m */,
8DA4304520BBEF3B00C47917 /* DefaultImageVC.h */,
8DA4304620BBEF3B00C47917 /* DefaultImageVC.m */,
8D69372422EC1E0200F91864 /* DefaultTopBottomVC.h */,
8D69372522EC1E0200F91864 /* DefaultTopBottomVC.m */,
8D0F8E211FD95DE300F30426 /* DefaultGradientEffectVC.h */,
8D0F8E221FD95DE300F30426 /* DefaultGradientEffectVC.m */,
8D0F8E2F1FD95DE300F30426 /* DefaultZoomVC.h */,
Expand Down Expand Up @@ -593,7 +588,6 @@
8D0F8E6E1FD95E2300F30426 /* ChildVCSeven.m in Sources */,
8D5BB745213AC303000E929E /* ChildTempPopGestureVC.m in Sources */,
8D0F8E371FD95DE300F30426 /* DefaultStaticVC.m in Sources */,
8D69372622EC1E0200F91864 /* DefaultTopBottomVC.m in Sources */,
182513D21F21CC340039F4A2 /* NavigationBarVC.m in Sources */,
8DCB02AA1F95B0FF00C9598A /* SGPageTitleViewConfigure.m in Sources */,
8D0F8E3A1FD95DE300F30426 /* DefaultZoomVC.m in Sources */,
Expand Down
39 changes: 19 additions & 20 deletions SGPagingViewExample/MainVC/DefaultCoverVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
#import "ChildVCOne.h"
#import "ChildVCTwo.h"
#import "ChildVCThree.h"
#import "ChildVCFour.h"
#import "ChildVCFive.h"
#import "ChildVCSix.h"
#import "ChildVCSeven.h"
#import "ChildVCEight.h"
#import "ChildVCNine.h"

@interface DefaultCoverVC () <SGPageTitleViewDelegate, SGPageContentCollectionViewDelegate>
@property (nonatomic, strong) SGPageTitleView *pageTitleView;
Expand All @@ -43,29 +37,34 @@ - (void)setupPageView {
pageTitleViewY = 88;
}

NSArray *titleArr = @[@"精选", @"电影", @"电视剧", @"综艺", @"NBA", @"娱乐", @"动漫", @"演唱会", @"VIP会员"];
NSArray *titleArr = @[@"下载列表", @"上传列表", @"保存至手机"];
SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure];
configure.titleSelectedColor = [UIColor whiteColor];
configure.indicatorStyle = SGIndicatorStyleCover;
configure.indicatorColor = [UIColor blackColor];
configure.indicatorAdditionalWidth = 100; // 说明:指示器额外增加的宽度,不设置,指示器宽度为标题文字宽度;若设置无限大,则指示器宽度为按钮宽度
configure.indicatorHeight = 122; // 说明:不设置,遮盖样式下,默认高度为文字高度 + 5;若设置无限大,则高度为 PageTitleView 高度
configure.titleColor = [UIColor lightGrayColor];
configure.titleSelectedColor = [UIColor blackColor];
// configure.indicatorStyle = SGIndicatorStyleCover;
CGFloat indicatorWidth = (self.view.frame.size.width - 60)/3 - 5;
// configure.indicatorAdditionalWidth = indicatorWidth;
configure.indicatorColor = [UIColor whiteColor];
configure.indicatorHeight = 38;
configure.indicatorCornerRadius = 10;
configure.titleGradientEffect = YES;
configure.showBottomSeparator = NO;
// 由于指示器是固定长度,而 SGIndicatorStyleCover 样式下额外宽度是在标题文字的基础上再增加的,不满足需求。故这里使用 SGIndicatorStyleFixed 样式,并配置相关属性
configure.indicatorStyle = SGIndicatorStyleFixed;
configure.indicatorFixedWidth = indicatorWidth;
configure.indicatorToBottomDistance = 0.5 * (44 - 38);
configure.indicatorAnimationTime = 0.05;

/// pageTitleView
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, pageTitleViewY, self.view.frame.size.width, 44) delegate:self titleNames:titleArr configure:configure];
self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(30, pageTitleViewY, self.view.frame.size.width - 60, 44) delegate:self titleNames:titleArr configure:configure];
self.pageTitleView.layer.cornerRadius = 10;
self.pageTitleView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
[self.view addSubview:_pageTitleView];

ChildVCOne *oneVC = [[ChildVCOne alloc] init];
ChildVCTwo *twoVC = [[ChildVCTwo alloc] init];
ChildVCThree *threeVC = [[ChildVCThree alloc] init];
ChildVCFour *fourVC = [[ChildVCFour alloc] init];
ChildVCFive *fiveVC = [[ChildVCFive alloc] init];
ChildVCSix *sixVC = [[ChildVCSix alloc] init];
ChildVCSeven *sevenVC = [[ChildVCSeven alloc] init];
ChildVCEight *eightVC = [[ChildVCEight alloc] init];
ChildVCNine *nineVC = [[ChildVCNine alloc] init];
NSArray *childArr = @[oneVC, twoVC, threeVC, fourVC, fiveVC, sixVC, sevenVC, eightVC, nineVC];
NSArray *childArr = @[oneVC, twoVC, threeVC];
/// pageContentCollectionView
CGFloat ContentCollectionViewHeight = self.view.frame.size.height - CGRectGetMaxY(_pageTitleView.frame);
self.pageContentCollectionView = [[SGPageContentCollectionView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_pageTitleView.frame), self.view.frame.size.width, ContentCollectionViewHeight) parentVC:self childVCs:childArr];
Expand Down
17 changes: 0 additions & 17 deletions SGPagingViewExample/MainVC/DefaultTopBottomVC.h

This file was deleted.

185 changes: 0 additions & 185 deletions SGPagingViewExample/MainVC/DefaultTopBottomVC.m

This file was deleted.

Loading

0 comments on commit 582edde

Please sign in to comment.