├── .DS_Store ├── 高仿今日头条01.gif ├── 高仿今日头条02.gif ├── 高仿今日头条03.gif ├── LZBPageView ├── .DS_Store ├── LZBPageView │ ├── .DS_Store │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Info.plist │ ├── LZBPageView │ │ ├── LZBPageStyleModel.swift │ │ ├── LZBPageView.swift │ │ ├── UIColor-Extension.swift │ │ ├── LZBContentView.swift │ │ └── LZBTitleView.swift │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ └── ViewController.swift └── LZBPageView.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── project.pbxproj ├── README.md ├── .gitignore └── LICENSE /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzbgithubcode/LZBPageView/HEAD/.DS_Store -------------------------------------------------------------------------------- /高仿今日头条01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzbgithubcode/LZBPageView/HEAD/高仿今日头条01.gif -------------------------------------------------------------------------------- /高仿今日头条02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzbgithubcode/LZBPageView/HEAD/高仿今日头条02.gif -------------------------------------------------------------------------------- /高仿今日头条03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzbgithubcode/LZBPageView/HEAD/高仿今日头条03.gif -------------------------------------------------------------------------------- /LZBPageView/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzbgithubcode/LZBPageView/HEAD/LZBPageView/.DS_Store -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lzbgithubcode/LZBPageView/HEAD/LZBPageView/LZBPageView/.DS_Store -------------------------------------------------------------------------------- /LZBPageView/LZBPageView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LZBPageView 2 | swift3.0 模仿今日头条、网易新闻滚动界面,最全封装结构,可以直接通过属性配置调用 3 | 4 | githud地址:[模仿今日头条、网易新闻滚动界面](https://github.com/lzbgithubcode/LZBPageView) 5 | 6 | 简书地址: [模仿今日头条、网易新闻滚动界面](http://www.jianshu.com/p/3170d0d886a2) 7 | 8 | 效果图 9 | 10 | 11 | ![高仿今日头条01](https://github.com/lzbgithubcode/LZBPageView/blob/master/高仿今日头条01.gif) 12 | 13 | ![高仿今日头条02](https://github.com/lzbgithubcode/LZBPageView/blob/master/高仿今日头条02.gif) 14 | 15 | ![高仿今日头条03](https://github.com/lzbgithubcode/LZBPageView/blob/master/高仿今日头条03.gif) 16 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LZBPageView 4 | // 5 | // Created by zibin on 2017/5/15. 6 | // Created by zibin on 2017/5/12. 7 | // Copyright © 2017年 项目共享githud地址:https://github.com/lzbgithubcode/LZBPageView 简书详解地址:http://www.jianshu.com/p/3170d0d886a2 作者喜欢分享技术与开发资料,如果你也是喜欢分享的人可以加入我们iOS资料demo共享群:490658347. All rights reserved. 8 | // 9 | 10 | import UIKit 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 19 | // Override point for customization after application launch. 20 | return true 21 | } 22 | 23 | 24 | 25 | 26 | } 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/LZBPageView/LZBPageStyleModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LZBPageStyleModel.swift 3 | // LZBPageView 4 | // 5 | // Created by zibin on 2017/5/12. 6 | // Copyright © 2017年 项目共享githud地址:https://github.com/lzbgithubcode/LZBPageView 简书详解地址:http://www.jianshu.com/p/3170d0d886a2 作者喜欢分享技术与开发资料,如果你也是喜欢分享的人可以加入我们iOS资料demo共享群:490658347. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | struct LZBPageStyleModel { 12 | 13 | var titleViewHeight : CGFloat = 44 //标题栏默认高度 14 | var titleViewTitleNormalColor : UIColor = UIColor(r: 0, g: 0, b: 0) //正常情况默认黑色 15 | var titleViewTitleSelectColor : UIColor = UIColor(r: 255, g: 0, b: 7) //选中情况默认红色 16 | var titleViewTitleFont : UIFont = UIFont.systemFont(ofSize: 14.0) //默认字体 17 | var isScrollEnable : Bool = false //默认不可以滚动 18 | var titleViewMargin : CGFloat = 20.0 //默认间距 19 | 20 | var isShowBottomLine : Bool = true //是否显示底部线 21 | var bottomLineHeight : CGFloat = 2.0 //底部线的默认高度 22 | var bottomLineColor : UIColor = UIColor.red //底部线默认颜色 23 | 24 | var isNeedScale : Bool = false //是否需要放大 25 | var maxScale : CGFloat = 1.2 //缩放的最大值 26 | 27 | var isNeedMask : Bool = false //是否需要遮罩 28 | var maskColor : UIColor = UIColor(white: 0.4, alpha: 0.5) //遮罩颜色 29 | var maskInsetMargin : CGFloat = 10.0 //遮罩内部间距 30 | var maskHeight : CGFloat = 25.0 //遮罩高度 31 | var maskLayerRadius : CGFloat = 12.5 //遮罩圆角 32 | 33 | } 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/LZBPageView/LZBPageView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LZBPageView.swift 3 | // LZBPageView 4 | // 5 | // Created by zibin on 2017/5/12. 6 | // Copyright © 2017年 项目共享githud地址:https://github.com/lzbgithubcode/LZBPageView 简书详解地址:http://www.jianshu.com/p/3170d0d886a2 作者喜欢分享技术与开发资料,如果你也是喜欢分享的人可以加入我们iOS资料demo共享群:490658347. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class LZBPageView: UIView { 12 | //MARK - 属性保存 13 | var titles : [String] 14 | var pageStyle : LZBPageStyleModel 15 | var childVcs : [UIViewController] 16 | var parentVc : UIViewController 17 | 18 | init(frame: CGRect, titles : [String], pageStyle : LZBPageStyleModel, childVcs : [UIViewController] , parentVc: UIViewController) { 19 | self.titles = titles 20 | self.pageStyle = pageStyle 21 | self.childVcs = childVcs 22 | self.parentVc = parentVc 23 | super.init(frame:frame) 24 | self.setupUI() 25 | } 26 | required init?(coder aDecoder: NSCoder) { 27 | fatalError("init(coder:) has not been implemented") 28 | } 29 | 30 | } 31 | 32 | //MARK: UI初始化 33 | extension LZBPageView { 34 | 35 | fileprivate func setupUI(){ 36 | //1.创建titleView 37 | let titleViewFrame = CGRect(x: 0, y: 0, width: bounds.width, height: self.pageStyle.titleViewHeight) 38 | let titleView = LZBTitleView(frame: titleViewFrame, titles: self.titles, style: self.pageStyle) 39 | titleView.backgroundColor = UIColor.orange 40 | self.addSubview(titleView) 41 | //2.创建内容View 42 | let contentFrame = CGRect(x: 0, y: titleView.frame.maxY, width: bounds.width, height: bounds.height - titleView.frame.maxY) 43 | let contentView = LZBContentView(frame: contentFrame, childVcs: childVcs, parentVc: parentVc, style: pageStyle) 44 | contentView.backgroundColor = UIColor.blue 45 | self.addSubview(contentView) 46 | 47 | //3.设置代理对象 48 | titleView.delegate = contentView 49 | contentView.delegate = titleView 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // LZBPageView 4 | // 5 | // Created by zibin on 2017/5/12. 6 | // Copyright © 2017年 项目共享githud地址:https://github.com/lzbgithubcode/LZBPageView 简书详解地址:http://www.jianshu.com/p/3170d0d886a2 作者喜欢分享技术与开发资料,如果你也是喜欢分享的人可以加入我们iOS资料demo共享群:490658347. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | self.automaticallyAdjustsScrollViewInsets = false 17 | let pageFrame = CGRect(x : 0, y : 64, width : view.bounds.size.width, height : view.bounds.size.height-64) 18 | //1.创建标题 19 | //let titles = ["英雄联盟","火蓝","提姆队长","史前巨鳄"] 20 | let titles = ["英雄联盟","火蓝","提姆队长","史前巨鳄","洛克萨斯之手","狗头","武器"] 21 | //2.创建控制器数组 22 | var childvcs = [UIViewController]() 23 | for i in 0..UIColor 14 | { 15 | return UIColor(red: CGFloat(arc4random_uniform(255))/255.0, green: CGFloat(arc4random_uniform(255))/255.0, blue: CGFloat(arc4random_uniform(255))/255.0, alpha: 1.0) 16 | } 17 | //特性:1、在extension扩展,必须使用convenience便利构造函数 18 | // 2.必须调用self.init,构造默认没有返回值,但是系统会自动返回但是不能返回nil 19 | convenience init(r : CGFloat , g : CGFloat, b : CGFloat, a : CGFloat = 1.0){ 20 | self.init(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: a) 21 | } 22 | 23 | //颜色转换 24 | convenience init?(colorHexString : String) { 25 | //1.判断字符串长度是否大于6 26 | guard colorHexString.characters.count >= 6 else { 27 | return nil 28 | } 29 | //2.将字符串转化为大写 30 | var hextempString = colorHexString.uppercased() 31 | 32 | //3.判断字符串是否是颜色字符串 33 | if hextempString.hasPrefix("0X") || hextempString.hasPrefix("##"){ 34 | hextempString = (hextempString as NSString).substring(to: 2) 35 | } 36 | 37 | //4.分离出rgb的十六进制 38 | var range = NSRange(location: 0, length: 2) 39 | let rhex = (hextempString as NSString).substring(with: range) 40 | range.location = 2 41 | let ghex = (hextempString as NSString).substring(with: range) 42 | range.location = 4 43 | let bhex = (hextempString as NSString).substring(with: range) 44 | 45 | //5.scaner转化 46 | var r : UInt32 = 0 47 | var g : UInt32 = 0 48 | var b : UInt32 = 0 49 | Scanner(string: rhex).scanHexInt32(&r) 50 | Scanner(string: ghex).scanHexInt32(&g) 51 | Scanner(string: bhex).scanHexInt32(&b) 52 | 53 | self.init(r: CGFloat(r), g: CGFloat(g), b: CGFloat(b)) 54 | } 55 | 56 | //获取颜色的RGB值 57 | func getRGBValue() -> (CGFloat , CGFloat , CGFloat){ 58 | guard let components = self.cgColor.components else { 59 | fatalError("获取颜色的RGB值失败") 60 | } 61 | return (components[0] * 255,components[1] * 255,components[2] * 255) 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/LZBPageView/LZBContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LZBContentView.swift 3 | // LZBPageView 4 | // 5 | // Created by zibin on 2017/5/12. 6 | // Copyright © 2017年 项目共享githud地址:https://github.com/lzbgithubcode/LZBPageView 简书详解地址:http://www.jianshu.com/p/3170d0d886a2 作者喜欢分享技术与开发资料,如果你也是喜欢分享的人可以加入我们iOS资料demo共享群:490658347. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol LZBContentViewDelegate : class { 12 | func contentView(contentView : LZBContentView , didScrollEnd index : Int) 13 | func contentView(contentView : LZBContentView , soureIndex : Int, targetIndex : Int, progress : CGFloat) 14 | } 15 | 16 | private let kLZBContentViewCellID = "kLZBContentViewCellID" 17 | 18 | class LZBContentView: UIView{ 19 | 20 | weak var delegate : LZBContentViewDelegate? 21 | fileprivate var childVcs : [UIViewController] 22 | fileprivate var style : LZBPageStyleModel 23 | fileprivate var parentVc : UIViewController 24 | fileprivate var startOffsetX : CGFloat = 0 25 | fileprivate var isForbidDelegate : Bool = false 26 | //懒加载collectionView 27 | fileprivate lazy var collectionView : UICollectionView = { 28 | let layout = UICollectionViewFlowLayout() 29 | layout.itemSize = self.bounds.size 30 | layout.minimumLineSpacing = 0 31 | layout.minimumInteritemSpacing = 0 32 | layout.scrollDirection = .horizontal 33 | let collectionView = UICollectionView(frame: self.bounds, collectionViewLayout: layout) 34 | collectionView.dataSource = self 35 | collectionView.delegate = self 36 | collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier:kLZBContentViewCellID) 37 | collectionView.isPagingEnabled = true 38 | collectionView.showsHorizontalScrollIndicator = false 39 | collectionView.bounces = false 40 | collectionView.scrollsToTop = false 41 | return collectionView 42 | }() 43 | 44 | 45 | init(frame : CGRect, childVcs : [UIViewController], parentVc : UIViewController, style : LZBPageStyleModel) { 46 | self.childVcs = childVcs 47 | self.style = style 48 | self.parentVc = parentVc 49 | super.init(frame: frame) 50 | self.setupUI() 51 | 52 | } 53 | 54 | required init?(coder aDecoder: NSCoder) { 55 | fatalError("init(coder:) has not been implemented") 56 | } 57 | 58 | } 59 | //MARK:- 初始化UI界面 60 | extension LZBContentView { 61 | fileprivate func setupUI(){ 62 | //1.将子控制器加入到父控制器 63 | for childVC in self.childVcs { 64 | self.parentVc.addChildViewController(childVC) 65 | } 66 | 67 | addSubview(self.collectionView) 68 | } 69 | } 70 | 71 | //MARK:- 遵守数据协议UICollectionViewDataSource 72 | extension LZBContentView : UICollectionViewDataSource{ 73 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 74 | return childVcs.count 75 | } 76 | 77 | 78 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 79 | 80 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kLZBContentViewCellID, for: indexPath) 81 | //移除之前的Veiw 82 | for subview in cell.contentView.subviews { 83 | subview.removeFromSuperview() 84 | } 85 | //增加新的View 86 | let subChildvc = self.childVcs[indexPath.item] 87 | cell.contentView.addSubview(subChildvc.view) 88 | 89 | return cell 90 | } 91 | } 92 | 93 | 94 | //MARK:- 遵守代理协议UICollectionViewDelegate 95 | extension LZBContentView : UICollectionViewDelegate{ 96 | 97 | //滚动完成监听 - 减速完成 98 | func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { 99 | self.contentViewScrollDidEnd() 100 | } 101 | //滚动完成监听 - 拖拽完成 102 | func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) { 103 | if !decelerate{ 104 | self.contentViewScrollDidEnd() 105 | } 106 | } 107 | 108 | //滚动完成 109 | fileprivate func contentViewScrollDidEnd(){ 110 | let currentIndex = Int(collectionView.contentOffset.x/collectionView.bounds.width) 111 | delegate?.contentView(contentView: self, didScrollEnd: currentIndex) 112 | } 113 | 114 | //记录起始位置的offsetX 115 | func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { 116 | self.startOffsetX = collectionView.contentOffset.x 117 | isForbidDelegate = false 118 | } 119 | 120 | //滚动进度 121 | func scrollViewDidScroll(_ scrollView: UIScrollView) { 122 | 123 | 124 | //当前偏移量 125 | let currentOffsetX = collectionView.contentOffset.x 126 | 127 | guard !isForbidDelegate else { 128 | return 129 | } 130 | 131 | //如果相等就是没有动 132 | guard currentOffsetX != startOffsetX else { 133 | return 134 | } 135 | 136 | var soureIndex = 0 137 | var targetIndex = 0 138 | var progress : CGFloat = 0 139 | let collectionViewWidth = collectionView.bounds.width 140 | 141 | //判断左右滑动 142 | if currentOffsetX > startOffsetX{ //左滑 143 | soureIndex = Int(currentOffsetX/collectionViewWidth) 144 | targetIndex = soureIndex + 1 145 | if targetIndex >= self.childVcs.count{ 146 | targetIndex = self.childVcs.count - 1 147 | } 148 | //进度 149 | progress = (currentOffsetX - startOffsetX)/collectionViewWidth 150 | 151 | if (currentOffsetX - startOffsetX) == collectionViewWidth{ 152 | targetIndex = soureIndex 153 | } 154 | } 155 | else //右滑 156 | { 157 | targetIndex = Int(currentOffsetX/collectionViewWidth) 158 | soureIndex = targetIndex + 1 159 | progress = (startOffsetX - currentOffsetX)/collectionViewWidth 160 | 161 | } 162 | delegate?.contentView(contentView: self, soureIndex: soureIndex, targetIndex: targetIndex, progress: progress) 163 | } 164 | } 165 | 166 | //MARK:- 遵守titleView点击协议 167 | extension LZBContentView : LZBTitleViewDelegate{ 168 | func titleView(_ titleView: LZBTitleView, targetIndex: NSInteger) { 169 | 170 | //点击禁止代理 171 | self.isForbidDelegate = true 172 | 173 | //1.选中标题对应的indexPath 174 | let indexPath = IndexPath(item: targetIndex, section: 0) 175 | 176 | //2.滚动到对应的cell 177 | collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: false) 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView/LZBPageView/LZBTitleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LZBTitleView.swift 3 | // LZBPageView 4 | // 5 | // Created by zibin on 2017/5/12. 6 | // Copyright © 2017年 项目共享githud地址:https://github.com/lzbgithubcode/LZBPageView 简书详解地址:http://www.jianshu.com/p/3170d0d886a2 作者喜欢分享技术与开发资料,如果你也是喜欢分享的人可以加入我们iOS资料demo共享群:490658347. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | //用class表示只有类可以继承协议,本来不需要声明什么的 12 | protocol LZBTitleViewDelegate : class { 13 | func titleView(_ titleView : LZBTitleView, targetIndex : NSInteger) 14 | } 15 | 16 | 17 | class LZBTitleView: UIView { 18 | weak var delegate : LZBTitleViewDelegate? 19 | fileprivate var titles : [String] 20 | fileprivate var style : LZBPageStyleModel 21 | 22 | fileprivate var currentIndex : NSInteger = 0 23 | 24 | fileprivate lazy var titleLabels : [UILabel] = [UILabel]() 25 | fileprivate lazy var normalColor : (CGFloat, CGFloat, CGFloat) = self.style.titleViewTitleNormalColor.getRGBValue() 26 | fileprivate lazy var selectColor : (CGFloat, CGFloat, CGFloat) = self.style.titleViewTitleSelectColor.getRGBValue() 27 | 28 | //懒加载 29 | fileprivate lazy var deltaColor : (CGFloat, CGFloat, CGFloat) = { 30 | let rdelta = self.selectColor.0 - self.normalColor.0 31 | let gdelta = self.selectColor.1 - self.normalColor.1 32 | let bdelta = self.selectColor.2 - self.normalColor.2 33 | return (rdelta , gdelta , bdelta) 34 | }() 35 | fileprivate lazy var scrollView : UIScrollView = { 36 | let scrollView = UIScrollView(frame: self.bounds) 37 | scrollView.showsHorizontalScrollIndicator = false 38 | scrollView.scrollsToTop = false 39 | return scrollView 40 | }() 41 | fileprivate lazy var bottomLine : UIView = { 42 | let bottomLine = UIView() 43 | bottomLine.backgroundColor = self.style.bottomLineColor 44 | return bottomLine 45 | }() 46 | fileprivate lazy var lableMaskView : UIView = { 47 | let lableMaskView = UIView() 48 | lableMaskView.backgroundColor = self.style.maskColor 49 | return lableMaskView 50 | }() 51 | 52 | //Mark:- 构造函数 53 | init(frame : CGRect, titles : [String], style : LZBPageStyleModel) { 54 | self.titles = titles 55 | self.style = style 56 | super.init(frame: frame) 57 | setupUI() 58 | } 59 | 60 | required init?(coder aDecoder: NSCoder) { 61 | fatalError("init(coder:) has not been implemented") 62 | } 63 | } 64 | 65 | 66 | //MARK:- 初始化UI 67 | extension LZBTitleView { 68 | 69 | fileprivate func setupUI(){ 70 | addSubview(scrollView) 71 | setupTitles() 72 | if self.style.isShowBottomLine{ 73 | self.setupBottomLine() 74 | } 75 | 76 | if self.style.isNeedMask{ 77 | self.setupMaskView() 78 | } 79 | 80 | } 81 | 82 | 83 | private func setupBottomLine(){ 84 | scrollView.addSubview(self.bottomLine) 85 | guard let titleLabel = self.titleLabels.first else { 86 | return 87 | } 88 | bottomLine.frame = titleLabel.frame 89 | bottomLine.frame.size.height = self.style.bottomLineHeight 90 | bottomLine.frame.origin.y = bounds.height - self.style.bottomLineHeight 91 | } 92 | 93 | private func setupMaskView(){ 94 | scrollView.addSubview(self.lableMaskView) 95 | guard let titleLabel = self.titleLabels.first else { 96 | return 97 | } 98 | 99 | let maskH : CGFloat = style.maskHeight 100 | let maskY : CGFloat = (titleLabel.frame.height - maskH) * 0.5 101 | var maskX : CGFloat = titleLabel.frame.origin.x 102 | var maskW : CGFloat = titleLabel.frame.width 103 | 104 | if self.style.isScrollEnable { 105 | maskX = maskX - self.style.maskInsetMargin 106 | maskW = maskW + self.style.maskInsetMargin * 2 107 | } 108 | 109 | lableMaskView.layer.frame = CGRect(x: maskX, y: maskY, width: maskW, height: maskH) 110 | lableMaskView.layer.cornerRadius = style.maskLayerRadius 111 | lableMaskView.layer.masksToBounds = true 112 | } 113 | 114 | private func setupTitles(){ 115 | //1.初始化标题 116 | let count = self.titles.count 117 | for i in 0.. maxOffsetX{ 235 | offsetX = maxOffsetX 236 | } 237 | scrollView.setContentOffset(CGPoint(x: offsetX, y: 0), animated: true) 238 | } 239 | 240 | } 241 | 242 | //MARK:- 遵守LZBContentViewDelegate协议 243 | extension LZBTitleView : LZBContentViewDelegate{ 244 | func contentView(contentView: LZBContentView, didScrollEnd index: Int) { 245 | guard index <= self.titleLabels.count else { 246 | return 247 | } 248 | currentIndex = index 249 | self.adjustTargetOffset() 250 | } 251 | 252 | func contentView(contentView: LZBContentView, soureIndex: Int, targetIndex: Int, progress: CGFloat) { 253 | 254 | //1.获取变化的label 255 | let soureLabel = self.titleLabels[soureIndex] 256 | let targetLabel = self.titleLabels[targetIndex] 257 | 258 | //2.颜色渐变 259 | soureLabel.textColor = UIColor(r: (self.selectColor.0 - deltaColor.0) * progress, g: (self.selectColor.1 - deltaColor.1) * progress, b: (self.selectColor.2 - deltaColor.2) * progress) 260 | targetLabel.textColor = UIColor(r: (self.normalColor.0 + deltaColor.0) * progress, g: (self.normalColor.1 + deltaColor.1) * progress, b: (self.normalColor.2 + deltaColor.2) * progress) 261 | 262 | //4.拖动contentView,改变字体大小 263 | if self.style.isNeedScale { 264 | let deltaScale = self.style.maxScale - 1.0 265 | soureLabel.transform = CGAffineTransform(scaleX: self.style.maxScale - deltaScale * progress, y: self.style.maxScale - deltaScale * progress) 266 | targetLabel.transform = CGAffineTransform(scaleX: 1.0 + deltaScale * progress, y: 1.0 + deltaScale * progress) 267 | } 268 | 269 | let deltaWidth = targetLabel.frame.width - soureLabel.frame.width 270 | let deltaX = targetLabel.frame.origin.x - soureLabel.frame.origin.x 271 | //3.拖动contentView,下划线渐变 272 | if self.style.isShowBottomLine { 273 | bottomLine.frame.size.width = soureLabel.frame.width + deltaWidth * progress 274 | bottomLine.frame.origin.x = soureLabel.frame.origin.x + deltaX * progress 275 | } 276 | 277 | //4.拖动contenView,mask渐变 278 | if self.style.isNeedMask { 279 | self.lableMaskView.frame.size.width = self.style.isScrollEnable ? soureLabel.frame.width + 2 * self.style.maskInsetMargin + deltaWidth * progress : soureLabel.frame.width + deltaWidth * progress 280 | self.lableMaskView.frame.origin.x = self.style.isScrollEnable ? soureLabel.frame.origin.x - self.style.maskInsetMargin + deltaX * progress : soureLabel.frame.origin.x + deltaX * progress 281 | 282 | } 283 | 284 | } 285 | 286 | 287 | } 288 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LZBPageView/LZBPageView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C884D6691EC9841300A09945 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C884D6681EC9841300A09945 /* AppDelegate.swift */; }; 11 | C884D66B1EC9841300A09945 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C884D66A1EC9841300A09945 /* ViewController.swift */; }; 12 | C884D66E1EC9841300A09945 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C884D66C1EC9841300A09945 /* Main.storyboard */; }; 13 | C884D6701EC9841300A09945 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C884D66F1EC9841300A09945 /* Assets.xcassets */; }; 14 | C884D6731EC9841300A09945 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C884D6711EC9841300A09945 /* LaunchScreen.storyboard */; }; 15 | C884D67C1EC984C100A09945 /* LZBPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C884D67B1EC984C100A09945 /* LZBPageView.swift */; }; 16 | C884D67E1EC984DB00A09945 /* LZBTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C884D67D1EC984DB00A09945 /* LZBTitleView.swift */; }; 17 | C884D6801EC984FF00A09945 /* LZBContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C884D67F1EC984FF00A09945 /* LZBContentView.swift */; }; 18 | C884D6821EC985C500A09945 /* LZBPageStyleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C884D6811EC985C500A09945 /* LZBPageStyleModel.swift */; }; 19 | C884D6861EC9996200A09945 /* UIColor-Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C884D6851EC9996200A09945 /* UIColor-Extension.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | C884D6651EC9841300A09945 /* LZBPageView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LZBPageView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | C884D6681EC9841300A09945 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | C884D66A1EC9841300A09945 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | C884D66D1EC9841300A09945 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | C884D66F1EC9841300A09945 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | C884D6721EC9841300A09945 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | C884D6741EC9841300A09945 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | C884D67B1EC984C100A09945 /* LZBPageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LZBPageView.swift; sourceTree = ""; }; 31 | C884D67D1EC984DB00A09945 /* LZBTitleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LZBTitleView.swift; sourceTree = ""; }; 32 | C884D67F1EC984FF00A09945 /* LZBContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LZBContentView.swift; sourceTree = ""; }; 33 | C884D6811EC985C500A09945 /* LZBPageStyleModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LZBPageStyleModel.swift; sourceTree = ""; }; 34 | C884D6851EC9996200A09945 /* UIColor-Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor-Extension.swift"; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | C884D6621EC9841300A09945 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | C884D65C1EC9841300A09945 = { 49 | isa = PBXGroup; 50 | children = ( 51 | C884D6671EC9841300A09945 /* LZBPageView */, 52 | C884D6661EC9841300A09945 /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | C884D6661EC9841300A09945 /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | C884D6651EC9841300A09945 /* LZBPageView.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | C884D6671EC9841300A09945 /* LZBPageView */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | C884D67A1EC9848D00A09945 /* LZBPageView */, 68 | C884D6681EC9841300A09945 /* AppDelegate.swift */, 69 | C884D66A1EC9841300A09945 /* ViewController.swift */, 70 | C884D66C1EC9841300A09945 /* Main.storyboard */, 71 | C884D66F1EC9841300A09945 /* Assets.xcassets */, 72 | C884D6711EC9841300A09945 /* LaunchScreen.storyboard */, 73 | C884D6741EC9841300A09945 /* Info.plist */, 74 | ); 75 | path = LZBPageView; 76 | sourceTree = ""; 77 | }; 78 | C884D67A1EC9848D00A09945 /* LZBPageView */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | C884D67B1EC984C100A09945 /* LZBPageView.swift */, 82 | C884D67D1EC984DB00A09945 /* LZBTitleView.swift */, 83 | C884D67F1EC984FF00A09945 /* LZBContentView.swift */, 84 | C884D6811EC985C500A09945 /* LZBPageStyleModel.swift */, 85 | C884D6851EC9996200A09945 /* UIColor-Extension.swift */, 86 | ); 87 | path = LZBPageView; 88 | sourceTree = ""; 89 | }; 90 | /* End PBXGroup section */ 91 | 92 | /* Begin PBXNativeTarget section */ 93 | C884D6641EC9841300A09945 /* LZBPageView */ = { 94 | isa = PBXNativeTarget; 95 | buildConfigurationList = C884D6771EC9841300A09945 /* Build configuration list for PBXNativeTarget "LZBPageView" */; 96 | buildPhases = ( 97 | C884D6611EC9841300A09945 /* Sources */, 98 | C884D6621EC9841300A09945 /* Frameworks */, 99 | C884D6631EC9841300A09945 /* Resources */, 100 | ); 101 | buildRules = ( 102 | ); 103 | dependencies = ( 104 | ); 105 | name = LZBPageView; 106 | productName = LZBPageView; 107 | productReference = C884D6651EC9841300A09945 /* LZBPageView.app */; 108 | productType = "com.apple.product-type.application"; 109 | }; 110 | /* End PBXNativeTarget section */ 111 | 112 | /* Begin PBXProject section */ 113 | C884D65D1EC9841300A09945 /* Project object */ = { 114 | isa = PBXProject; 115 | attributes = { 116 | LastSwiftUpdateCheck = 0830; 117 | LastUpgradeCheck = 0830; 118 | ORGANIZATIONNAME = Apple; 119 | TargetAttributes = { 120 | C884D6641EC9841300A09945 = { 121 | CreatedOnToolsVersion = 8.3.2; 122 | DevelopmentTeam = Y2H57HDYD9; 123 | ProvisioningStyle = Automatic; 124 | }; 125 | }; 126 | }; 127 | buildConfigurationList = C884D6601EC9841300A09945 /* Build configuration list for PBXProject "LZBPageView" */; 128 | compatibilityVersion = "Xcode 3.2"; 129 | developmentRegion = English; 130 | hasScannedForEncodings = 0; 131 | knownRegions = ( 132 | en, 133 | Base, 134 | ); 135 | mainGroup = C884D65C1EC9841300A09945; 136 | productRefGroup = C884D6661EC9841300A09945 /* Products */; 137 | projectDirPath = ""; 138 | projectRoot = ""; 139 | targets = ( 140 | C884D6641EC9841300A09945 /* LZBPageView */, 141 | ); 142 | }; 143 | /* End PBXProject section */ 144 | 145 | /* Begin PBXResourcesBuildPhase section */ 146 | C884D6631EC9841300A09945 /* Resources */ = { 147 | isa = PBXResourcesBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | C884D6731EC9841300A09945 /* LaunchScreen.storyboard in Resources */, 151 | C884D6701EC9841300A09945 /* Assets.xcassets in Resources */, 152 | C884D66E1EC9841300A09945 /* Main.storyboard in Resources */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXResourcesBuildPhase section */ 157 | 158 | /* Begin PBXSourcesBuildPhase section */ 159 | C884D6611EC9841300A09945 /* Sources */ = { 160 | isa = PBXSourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | C884D66B1EC9841300A09945 /* ViewController.swift in Sources */, 164 | C884D6801EC984FF00A09945 /* LZBContentView.swift in Sources */, 165 | C884D6691EC9841300A09945 /* AppDelegate.swift in Sources */, 166 | C884D67E1EC984DB00A09945 /* LZBTitleView.swift in Sources */, 167 | C884D67C1EC984C100A09945 /* LZBPageView.swift in Sources */, 168 | C884D6861EC9996200A09945 /* UIColor-Extension.swift in Sources */, 169 | C884D6821EC985C500A09945 /* LZBPageStyleModel.swift in Sources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXSourcesBuildPhase section */ 174 | 175 | /* Begin PBXVariantGroup section */ 176 | C884D66C1EC9841300A09945 /* Main.storyboard */ = { 177 | isa = PBXVariantGroup; 178 | children = ( 179 | C884D66D1EC9841300A09945 /* Base */, 180 | ); 181 | name = Main.storyboard; 182 | sourceTree = ""; 183 | }; 184 | C884D6711EC9841300A09945 /* LaunchScreen.storyboard */ = { 185 | isa = PBXVariantGroup; 186 | children = ( 187 | C884D6721EC9841300A09945 /* Base */, 188 | ); 189 | name = LaunchScreen.storyboard; 190 | sourceTree = ""; 191 | }; 192 | /* End PBXVariantGroup section */ 193 | 194 | /* Begin XCBuildConfiguration section */ 195 | C884D6751EC9841300A09945 /* Debug */ = { 196 | isa = XCBuildConfiguration; 197 | buildSettings = { 198 | ALWAYS_SEARCH_USER_PATHS = NO; 199 | CLANG_ANALYZER_NONNULL = YES; 200 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 201 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 202 | CLANG_CXX_LIBRARY = "libc++"; 203 | CLANG_ENABLE_MODULES = YES; 204 | CLANG_ENABLE_OBJC_ARC = YES; 205 | CLANG_WARN_BOOL_CONVERSION = YES; 206 | CLANG_WARN_CONSTANT_CONVERSION = YES; 207 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 208 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 209 | CLANG_WARN_EMPTY_BODY = YES; 210 | CLANG_WARN_ENUM_CONVERSION = YES; 211 | CLANG_WARN_INFINITE_RECURSION = YES; 212 | CLANG_WARN_INT_CONVERSION = YES; 213 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 214 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 215 | CLANG_WARN_UNREACHABLE_CODE = YES; 216 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 217 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 218 | COPY_PHASE_STRIP = NO; 219 | DEBUG_INFORMATION_FORMAT = dwarf; 220 | ENABLE_STRICT_OBJC_MSGSEND = YES; 221 | ENABLE_TESTABILITY = YES; 222 | GCC_C_LANGUAGE_STANDARD = gnu99; 223 | GCC_DYNAMIC_NO_PIC = NO; 224 | GCC_NO_COMMON_BLOCKS = YES; 225 | GCC_OPTIMIZATION_LEVEL = 0; 226 | GCC_PREPROCESSOR_DEFINITIONS = ( 227 | "DEBUG=1", 228 | "$(inherited)", 229 | ); 230 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 232 | GCC_WARN_UNDECLARED_SELECTOR = YES; 233 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 234 | GCC_WARN_UNUSED_FUNCTION = YES; 235 | GCC_WARN_UNUSED_VARIABLE = YES; 236 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 237 | MTL_ENABLE_DEBUG_INFO = YES; 238 | ONLY_ACTIVE_ARCH = YES; 239 | SDKROOT = iphoneos; 240 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 241 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 242 | }; 243 | name = Debug; 244 | }; 245 | C884D6761EC9841300A09945 /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_ANALYZER_NONNULL = YES; 250 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 252 | CLANG_CXX_LIBRARY = "libc++"; 253 | CLANG_ENABLE_MODULES = YES; 254 | CLANG_ENABLE_OBJC_ARC = YES; 255 | CLANG_WARN_BOOL_CONVERSION = YES; 256 | CLANG_WARN_CONSTANT_CONVERSION = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INFINITE_RECURSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 264 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 268 | COPY_PHASE_STRIP = NO; 269 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 270 | ENABLE_NS_ASSERTIONS = NO; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu99; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 276 | GCC_WARN_UNDECLARED_SELECTOR = YES; 277 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 278 | GCC_WARN_UNUSED_FUNCTION = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 281 | MTL_ENABLE_DEBUG_INFO = NO; 282 | SDKROOT = iphoneos; 283 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 284 | VALIDATE_PRODUCT = YES; 285 | }; 286 | name = Release; 287 | }; 288 | C884D6781EC9841300A09945 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | DEVELOPMENT_TEAM = Y2H57HDYD9; 293 | INFOPLIST_FILE = LZBPageView/Info.plist; 294 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 295 | PRODUCT_BUNDLE_IDENTIFIER = com.lzbwechat.lzbcoder.LZBPageView; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | SWIFT_VERSION = 3.0; 298 | }; 299 | name = Debug; 300 | }; 301 | C884D6791EC9841300A09945 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 305 | DEVELOPMENT_TEAM = Y2H57HDYD9; 306 | INFOPLIST_FILE = LZBPageView/Info.plist; 307 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 308 | PRODUCT_BUNDLE_IDENTIFIER = com.lzbwechat.lzbcoder.LZBPageView; 309 | PRODUCT_NAME = "$(TARGET_NAME)"; 310 | SWIFT_VERSION = 3.0; 311 | }; 312 | name = Release; 313 | }; 314 | /* End XCBuildConfiguration section */ 315 | 316 | /* Begin XCConfigurationList section */ 317 | C884D6601EC9841300A09945 /* Build configuration list for PBXProject "LZBPageView" */ = { 318 | isa = XCConfigurationList; 319 | buildConfigurations = ( 320 | C884D6751EC9841300A09945 /* Debug */, 321 | C884D6761EC9841300A09945 /* Release */, 322 | ); 323 | defaultConfigurationIsVisible = 0; 324 | defaultConfigurationName = Release; 325 | }; 326 | C884D6771EC9841300A09945 /* Build configuration list for PBXNativeTarget "LZBPageView" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | C884D6781EC9841300A09945 /* Debug */, 330 | C884D6791EC9841300A09945 /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | }; 334 | /* End XCConfigurationList section */ 335 | }; 336 | rootObject = C884D65D1EC9841300A09945 /* Project object */; 337 | } 338 | --------------------------------------------------------------------------------