├── LiuXSegment.xcodeproj
├── xcuserdata
│ └── liuxin.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── LiuXSegment.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── liuxin.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── project.pbxproj
├── LiuXSegment
├── ViewController.h
├── AppDelegate.h
├── main.m
├── LXSegment
│ ├── LXSegmentScrollView.h
│ ├── LiuXSegmentView.h
│ ├── Category
│ │ ├── NSString+Size.h
│ │ ├── CALayer+LXAdd.h
│ │ ├── CALayer+LXAdd.m
│ │ └── NSString+Size.m
│ ├── LXSegmentScrollView.m
│ └── LiuXSegmentView.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── Base.lproj
│ ├── Main.storyboard
│ └── LaunchScreen.storyboard
├── ViewController.m
└── AppDelegate.m
├── README.md
├── LiuXSegmentTests
├── Info.plist
└── LiuXSegmentTests.m
└── LiuXSegmentUITests
├── Info.plist
└── LiuXSegmentUITests.m
/LiuXSegment.xcodeproj/xcuserdata/liuxin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/LiuXSegment.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LiuXSegment.xcodeproj/project.xcworkspace/xcuserdata/liuxin.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xinge1/LiuXSegment/HEAD/LiuXSegment.xcodeproj/project.xcworkspace/xcuserdata/liuxin.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/LiuXSegment/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // LiuXSegment
4 | //
5 | // Created by 刘鑫 on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/LiuXSegment/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // LiuXSegment
4 | //
5 | // Created by 刘鑫 on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/LiuXSegment/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // LiuXSegment
4 | //
5 | // Created by 刘鑫 on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/LiuXSegment/LXSegment/LXSegmentScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LXSegmentScrollView.h
3 | // LiuXSegment
4 | //
5 | // Created by liuxin on 16/5/17.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LXSegmentScrollView : UIView
12 |
13 | -(instancetype)initWithFrame:(CGRect)frame
14 | titleArray:(NSArray *)titleArray
15 | contentViewArray:(NSArray *)contentViewArray;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LiuXSegment
2 | ##一款自定义的segment(类似网易)
3 | ###效果图
4 | 
5 |
6 | ###使用方法
7 | ####1.导入
8 | ```#import "LXSegmentScrollView.h" ```
9 | ####2.初始化方法
10 | ```
11 | LXSegmentScrollView *scView=[[LXSegmentScrollView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, self.view.bounds.size.height-64) titleArray:@[@"头条",@"搞笑",@"视频"] contentViewArray:array];
12 | [self.view addSubview:scView];
13 | ```
14 |
15 | ######注:因时间原因部分功能还没开发完,如有需求请自行添加,敬请原谅。
16 | ######如有任何问题欢迎大家交流指正。[我的简书地址](http://www.jianshu.com/p/503765ad19e4)
17 |
--------------------------------------------------------------------------------
/LiuXSegment/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 | }
--------------------------------------------------------------------------------
/LiuXSegmentTests/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 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LiuXSegmentUITests/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 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LiuXSegment.xcodeproj/xcuserdata/liuxin.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | LiuXSegment.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 4BA740951C9B9C28000A00BB
16 |
17 | primary
18 |
19 |
20 | 4BA740AE1C9B9C28000A00BB
21 |
22 | primary
23 |
24 |
25 | 4BA740B91C9B9C28000A00BB
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/LiuXSegmentTests/LiuXSegmentTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // LiuXSegmentTests.m
3 | // LiuXSegmentTests
4 | //
5 | // Created by 刘鑫 on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LiuXSegmentTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation LiuXSegmentTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LiuXSegment/LXSegment/LiuXSegmentView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LiuXSegmentView.h
3 | // LiuXSegment
4 | //
5 | // Created by liuxin on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 |
10 | #import
11 |
12 | typedef void(^btnClickBlock)(NSInteger index);
13 |
14 | @interface LiuXSegmentView : UIView
15 | /**
16 | * 未选中时的文字颜色,默认黑色
17 | */
18 | @property (nonatomic,strong) UIColor *titleNomalColor;
19 |
20 | /**
21 | * 选中时的文字颜色,默认红色
22 | */
23 | @property (nonatomic,strong) UIColor *titleSelectColor;
24 |
25 | /**
26 | * 字体大小,默认15
27 | */
28 | @property (nonatomic,strong) UIFont *titleFont;
29 |
30 | /**
31 | * 默认选中的index=1,即第一个
32 | */
33 | @property (nonatomic,assign) NSInteger defaultIndex;
34 |
35 | /**
36 | * 点击后的block
37 | */
38 | @property (nonatomic,copy)btnClickBlock block;
39 |
40 | /**
41 | * 初始化方法
42 | *
43 | * @param frame frame
44 | * @param titleArray 传入数组
45 | * @param block 点击后的回调
46 | *
47 | * @return
48 | */
49 | -(instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titleArray clickBlick:(btnClickBlock)block;
50 |
51 | -(void)updateselectLineFrameWithoffset:(CGFloat)offsetx;
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/LiuXSegment/LXSegment/Category/NSString+Size.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+Size.h
3 | // iOS-Categories (https://github.com/shaojiankui/iOS-Categories)
4 | //
5 | // Created by Jakey on 15/5/22.
6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @interface NSString (Size)
12 | /**
13 | * @brief 计算文字的高度
14 | *
15 | * @param font 字体(默认为系统字体)
16 | * @param width 约束宽度
17 | */
18 | - (CGFloat)heightWithFont:(UIFont *)font constrainedToWidth:(CGFloat)width;
19 | /**
20 | * @brief 计算文字的宽度
21 | *
22 | * @param font 字体(默认为系统字体)
23 | * @param height 约束高度
24 | */
25 | - (CGFloat)widthWithFont:(UIFont *)font constrainedToHeight:(CGFloat)height;
26 |
27 | /**
28 | * @brief 计算文字的大小
29 | *
30 | * @param font 字体(默认为系统字体)
31 | * @param width 约束宽度
32 | */
33 | - (CGSize)sizeWithFont:(UIFont *)font constrainedToWidth:(CGFloat)width;
34 | /**
35 | * @brief 计算文字的大小
36 | *
37 | * @param font 字体(默认为系统字体)
38 | * @param height 约束高度
39 | */
40 | - (CGSize)sizeWithFont:(UIFont *)font constrainedToHeight:(CGFloat)height;
41 |
42 | /**
43 | * @brief 反转字符串
44 | *
45 | * @param strSrc 被反转字符串
46 | *
47 | * @return 反转后字符串
48 | */
49 | + (NSString *)reverseString:(NSString *)strSrc;
50 | @end
51 |
--------------------------------------------------------------------------------
/LiuXSegment/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/LiuXSegmentUITests/LiuXSegmentUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // LiuXSegmentUITests.m
3 | // LiuXSegmentUITests
4 | //
5 | // Created by 刘鑫 on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LiuXSegmentUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation LiuXSegmentUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/LiuXSegment/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 |
--------------------------------------------------------------------------------
/LiuXSegment/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 |
--------------------------------------------------------------------------------
/LiuXSegment/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // LiuXSegment
4 | //
5 | // Created by 刘鑫 on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "LXSegmentScrollView.h"
11 |
12 | @interface ViewController ()
13 |
14 | @end
15 |
16 | @implementation ViewController
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view, typically from a nib.
21 | self.view.backgroundColor=[UIColor whiteColor];
22 | //iOS7新增属性
23 | self.automaticallyAdjustsScrollViewInsets=NO;
24 |
25 | NSMutableArray *array=[NSMutableArray array];
26 | for (int i =0; i<2; i++) {
27 | UIView *view=[[UIView alloc] init];
28 | if (i==0) {
29 | view.backgroundColor=[UIColor whiteColor];
30 | }if (i==1) {
31 | view.backgroundColor=[UIColor grayColor];
32 | }
33 | [array addObject:view];
34 | }
35 |
36 | UITableView *tbale=[[UITableView alloc] init];
37 | tbale.delegate=self;
38 | tbale.dataSource=self;
39 | tbale.rowHeight=100;
40 |
41 | [array addObject:tbale];
42 |
43 | LXSegmentScrollView *scView=[[LXSegmentScrollView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, self.view.bounds.size.height-64) titleArray:@[@"头条新闻",@"搞笑",@"视频想"] contentViewArray:array];
44 | [self.view addSubview:scView];
45 | }
46 |
47 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
48 | return 10;
49 | }
50 |
51 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
52 | static NSString *cellid=@"cell";
53 | UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellid];
54 | if (!cell) {
55 | cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid];
56 | }
57 | cell.textLabel.text=@"test";
58 |
59 | return cell;
60 |
61 | }
62 |
63 | - (void)didReceiveMemoryWarning {
64 | [super didReceiveMemoryWarning];
65 | // Dispose of any resources that can be recreated.
66 | }
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/LiuXSegment/LXSegment/Category/CALayer+LXAdd.h:
--------------------------------------------------------------------------------
1 | //
2 | // CALayer+LXAdd.h
3 | // LXAppFrameworkDemo
4 | //
5 | // Created by liuxin on 16/5/11.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CALayer (LXAdd)
12 |
13 |
14 | @property (nonatomic) CGFloat left; ///< Shortcut for frame.origin.x.
15 | @property (nonatomic) CGFloat top; ///< Shortcut for frame.origin.y
16 | @property (nonatomic) CGFloat right; ///< Shortcut for frame.origin.x + frame.size.width
17 | @property (nonatomic) CGFloat bottom; ///< Shortcut for frame.origin.y + frame.size.height
18 | @property (nonatomic) CGFloat width; ///< Shortcut for frame.size.width.
19 | @property (nonatomic) CGFloat height; ///< Shortcut for frame.size.height.
20 | @property (nonatomic) CGPoint center; ///< Shortcut for center.
21 | @property (nonatomic) CGFloat centerX; ///< Shortcut for center.x
22 | @property (nonatomic) CGFloat centerY; ///< Shortcut for center.y
23 | @property (nonatomic) CGPoint origin; ///< Shortcut for frame.origin.
24 | @property (nonatomic, getter=frameSize, setter=setFrameSize:) CGSize size; ///< Shortcut for frame.size.
25 |
26 | /**
27 | * 旋转
28 | */
29 | @property (nonatomic) CGFloat transformRotation; ///< key path "transform.rotation"
30 | @property (nonatomic) CGFloat transformRotationX; ///< key path "transform.rotation.x"
31 | @property (nonatomic) CGFloat transformRotationY; ///< key path "transform.rotation.y"
32 | @property (nonatomic) CGFloat transformRotationZ; ///< key path "transform.rotation.z"
33 |
34 | /**
35 | * 缩放
36 | */
37 | @property (nonatomic) CGFloat transformScale; ///< key path "transform.scale"
38 | @property (nonatomic) CGFloat transformScaleX; ///< key path "transform.scale.x"
39 | @property (nonatomic) CGFloat transformScaleY; ///< key path "transform.scale.y"
40 | @property (nonatomic) CGFloat transformScaleZ; ///< key path "transform.scale.z"
41 |
42 | /**
43 | * 平移
44 | */
45 | @property (nonatomic) CGFloat transformTranslationX; ///< key path "transform.translation.x"
46 | @property (nonatomic) CGFloat transformTranslationY; ///< key path "transform.translation.y"
47 | @property (nonatomic) CGFloat transformTranslationZ; ///< key path "transform.translation.z"
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/LiuXSegment/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // LiuXSegment
4 | //
5 | // Created by 刘鑫 on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "ViewController.h"
11 |
12 | @interface AppDelegate ()
13 |
14 | @end
15 |
16 | @implementation AppDelegate
17 |
18 |
19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
20 | // Override point for customization after application launch.
21 | ViewController *viewC=[[ViewController alloc] init];
22 | UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:viewC];
23 | self.window.rootViewController=nav;
24 | return YES;
25 | }
26 |
27 | - (void)applicationWillResignActive:(UIApplication *)application {
28 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
29 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
30 | }
31 |
32 | - (void)applicationDidEnterBackground:(UIApplication *)application {
33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
35 | }
36 |
37 | - (void)applicationWillEnterForeground:(UIApplication *)application {
38 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
39 | }
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
43 | }
44 |
45 | - (void)applicationWillTerminate:(UIApplication *)application {
46 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/LiuXSegment/LXSegment/LXSegmentScrollView.m:
--------------------------------------------------------------------------------
1 | //
2 | // LXSegmentScrollView.m
3 | // LiuXSegment
4 | //
5 | // Created by liuxin on 16/5/17.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #define MainScreen_W [UIScreen mainScreen].bounds.size.width
10 |
11 | #import "LXSegmentScrollView.h"
12 | #import "LiuXSegmentView.h"
13 |
14 | @interface LXSegmentScrollView()
15 | @property (strong,nonatomic)UIScrollView *bgScrollView;
16 | @property (strong,nonatomic)LiuXSegmentView *segmentToolView;
17 |
18 | @end
19 |
20 | @implementation LXSegmentScrollView
21 |
22 |
23 | -(instancetype)initWithFrame:(CGRect)frame
24 | titleArray:(NSArray *)titleArray
25 | contentViewArray:(NSArray *)contentViewArray{
26 | if (self = [super initWithFrame:frame]) {
27 |
28 | [self addSubview:self.bgScrollView];
29 |
30 |
31 | _segmentToolView=[[LiuXSegmentView alloc] initWithFrame:CGRectMake(0, 0, MainScreen_W, 35) titles:titleArray clickBlick:^void(NSInteger index) {
32 | NSLog(@"-----%ld",index);
33 | [_bgScrollView setContentOffset:CGPointMake(MainScreen_W*(index-1), 0)];
34 | }];
35 | [self addSubview:_segmentToolView];
36 |
37 |
38 | for (int i=0;i
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/LiuXSegment/LXSegment/Category/CALayer+LXAdd.m:
--------------------------------------------------------------------------------
1 | //
2 | // CALayer+LXAdd.m
3 | // LXAppFrameworkDemo
4 | //
5 | // Created by liuxin on 16/5/11.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #import "CALayer+LXAdd.h"
10 |
11 | @implementation CALayer (LXAdd)
12 |
13 | - (CGFloat)left {
14 | return self.frame.origin.x;
15 | }
16 |
17 | - (void)setLeft:(CGFloat)x {
18 | CGRect frame = self.frame;
19 | frame.origin.x = x;
20 | self.frame = frame;
21 | }
22 |
23 |
24 |
25 | - (CGFloat)top {
26 | return self.frame.origin.y;
27 | }
28 |
29 | - (void)setTop:(CGFloat)y {
30 | CGRect frame = self.frame;
31 | frame.origin.y = y;
32 | self.frame = frame;
33 | }
34 |
35 | - (CGFloat)right {
36 | return self.frame.origin.x + self.frame.size.width;
37 | }
38 |
39 | - (void)setRight:(CGFloat)right {
40 | CGRect frame = self.frame;
41 | frame.origin.x = right - frame.size.width;
42 | self.frame = frame;
43 | }
44 |
45 | - (CGFloat)bottom {
46 | return self.frame.origin.y + self.frame.size.height;
47 | }
48 |
49 | - (void)setBottom:(CGFloat)bottom {
50 | CGRect frame = self.frame;
51 | frame.origin.y = bottom - frame.size.height;
52 | self.frame = frame;
53 | }
54 |
55 | - (CGFloat)width {
56 | return self.frame.size.width;
57 | }
58 |
59 | - (void)setWidth:(CGFloat)width {
60 | CGRect frame = self.frame;
61 | frame.size.width = width;
62 | self.frame = frame;
63 | }
64 |
65 | - (CGFloat)height {
66 | return self.frame.size.height;
67 | }
68 |
69 | - (void)setHeight:(CGFloat)height {
70 | CGRect frame = self.frame;
71 | frame.size.height = height;
72 | self.frame = frame;
73 | }
74 |
75 | - (CGPoint)center {
76 | return CGPointMake(self.frame.origin.x + self.frame.size.width * 0.5,
77 | self.frame.origin.y + self.frame.size.height * 0.5);
78 | }
79 |
80 | - (void)setCenter:(CGPoint)center {
81 | CGRect frame = self.frame;
82 | frame.origin.x = center.x - frame.size.width * 0.5;
83 | frame.origin.y = center.y - frame.size.height * 0.5;
84 | self.frame = frame;
85 | }
86 |
87 | - (CGFloat)centerX {
88 | return self.frame.origin.x + self.frame.size.width * 0.5;
89 | }
90 |
91 | - (void)setCenterX:(CGFloat)centerX {
92 | CGRect frame = self.frame;
93 | frame.origin.x = centerX - frame.size.width * 0.5;
94 | self.frame = frame;
95 | }
96 |
97 | - (CGFloat)centerY {
98 | return self.frame.origin.y + self.frame.size.height * 0.5;
99 | }
100 |
101 | - (void)setCenterY:(CGFloat)centerY {
102 | CGRect frame = self.frame;
103 | frame.origin.y = centerY - frame.size.height * 0.5;
104 | self.frame = frame;
105 | }
106 |
107 | - (CGPoint)origin {
108 | return self.frame.origin;
109 | }
110 |
111 | - (void)setOrigin:(CGPoint)origin {
112 | CGRect frame = self.frame;
113 | frame.origin = origin;
114 | self.frame = frame;
115 | }
116 |
117 | - (CGSize)frameSize {
118 | return self.frame.size;
119 | }
120 |
121 | - (void)setFrameSize:(CGSize)size {
122 | CGRect frame = self.frame;
123 | frame.size = size;
124 | self.frame = frame;
125 | }
126 |
127 | - (CGFloat)transformRotation {
128 | NSNumber *v = [self valueForKeyPath:@"transform.rotation"];
129 | return v.doubleValue;
130 | }
131 |
132 | - (void)setTransformRotation:(CGFloat)v {
133 | [self setValue:@(v) forKeyPath:@"transform.rotation"];
134 | }
135 |
136 | - (CGFloat)transformRotationX {
137 | NSNumber *v = [self valueForKeyPath:@"transform.rotation.x"];
138 | return v.doubleValue;
139 | }
140 |
141 | - (void)setTransformRotationX:(CGFloat)v {
142 | [self setValue:@(v) forKeyPath:@"transform.rotation.x"];
143 | }
144 |
145 | - (CGFloat)transformRotationY {
146 | NSNumber *v = [self valueForKeyPath:@"transform.rotation.y"];
147 | return v.doubleValue;
148 | }
149 |
150 | - (void)setTransformRotationY:(CGFloat)v {
151 | [self setValue:@(v) forKeyPath:@"transform.rotation.y"];
152 | }
153 |
154 | - (CGFloat)transformRotationZ {
155 | NSNumber *v = [self valueForKeyPath:@"transform.rotation.z"];
156 | return v.doubleValue;
157 | }
158 |
159 | - (void)setTransformRotationZ:(CGFloat)v {
160 | [self setValue:@(v) forKeyPath:@"transform.rotation.z"];
161 | }
162 |
163 | - (CGFloat)transformScaleX {
164 | NSNumber *v = [self valueForKeyPath:@"transform.scale.x"];
165 | return v.doubleValue;
166 | }
167 |
168 | - (void)setTransformScaleX:(CGFloat)v {
169 | [self setValue:@(v) forKeyPath:@"transform.scale.x"];
170 | }
171 |
172 | - (CGFloat)transformScaleY {
173 | NSNumber *v = [self valueForKeyPath:@"transform.scale.y"];
174 | return v.doubleValue;
175 | }
176 |
177 | - (void)setTransformScaleY:(CGFloat)v {
178 | [self setValue:@(v) forKeyPath:@"transform.scale.y"];
179 | }
180 |
181 | - (CGFloat)transformScaleZ {
182 | NSNumber *v = [self valueForKeyPath:@"transform.scale.z"];
183 | return v.doubleValue;
184 | }
185 |
186 | - (void)setTransformScaleZ:(CGFloat)v {
187 | [self setValue:@(v) forKeyPath:@"transform.scale.z"];
188 | }
189 |
190 | - (CGFloat)transformScale {
191 | NSNumber *v = [self valueForKeyPath:@"transform.scale"];
192 | return v.doubleValue;
193 | }
194 |
195 | - (void)setTransformScale:(CGFloat)v {
196 | [self setValue:@(v) forKeyPath:@"transform.scale"];
197 | }
198 |
199 | - (CGFloat)transformTranslationX {
200 | NSNumber *v = [self valueForKeyPath:@"transform.translation.x"];
201 | return v.doubleValue;
202 | }
203 |
204 | - (void)setTransformTranslationX:(CGFloat)v {
205 | [self setValue:@(v) forKeyPath:@"transform.translation.x"];
206 | }
207 |
208 | - (CGFloat)transformTranslationY {
209 | NSNumber *v = [self valueForKeyPath:@"transform.translation.y"];
210 | return v.doubleValue;
211 | }
212 |
213 | - (void)setTransformTranslationY:(CGFloat)v {
214 | [self setValue:@(v) forKeyPath:@"transform.translation.y"];
215 | }
216 |
217 | - (CGFloat)transformTranslationZ {
218 | NSNumber *v = [self valueForKeyPath:@"transform.translation.z"];
219 | return v.doubleValue;
220 | }
221 |
222 | - (void)setTransformTranslationZ:(CGFloat)v {
223 | [self setValue:@(v) forKeyPath:@"transform.translation.z"];
224 | }
225 |
226 |
227 | @end
228 |
--------------------------------------------------------------------------------
/LiuXSegment/LXSegment/LiuXSegmentView.m:
--------------------------------------------------------------------------------
1 | //
2 | // LiuXSegmentView.m
3 | // LiuXSegment
4 | //
5 | // Created by liuxin on 16/3/18.
6 | // Copyright © 2016年 liuxin. All rights reserved.
7 | //
8 |
9 | #define windowContentWidth ([[UIScreen mainScreen] bounds].size.width)
10 | #define SFQRedColor [UIColor colorWithRed:255/255.0 green:92/255.0 blue:79/255.0 alpha:1]
11 | #define MAX_TitleNumInWindow 5
12 |
13 | #import "LiuXSegmentView.h"
14 | #import "CALayer+LXAdd.h"
15 | #import "NSString+Size.h"
16 |
17 | @interface LiuXSegmentView()
18 |
19 | @property (nonatomic,strong) NSMutableArray *btns;
20 | @property (nonatomic,strong) NSArray *titles;
21 | @property (nonatomic,strong) NSMutableArray *titlesStrWidthArray;
22 | @property (nonatomic,strong) UIButton *titleBtn;
23 | @property (nonatomic,strong) UIScrollView *bgScrollView;
24 | @property (nonatomic,strong) UIView *selectLine;
25 | @property (nonatomic,assign) CGFloat btn_w;
26 | @end
27 |
28 | @implementation LiuXSegmentView
29 |
30 |
31 | -(instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titleArray clickBlick:(btnClickBlock)block{
32 | self = [super initWithFrame:frame];
33 | if (self) {
34 |
35 | self.layer.shadowColor=[UIColor blackColor].CGColor;
36 | self.layer.shadowOffset=CGSizeMake(2, 2);
37 | self.layer.shadowRadius=2;
38 | self.layer.shadowOpacity=.2;
39 |
40 | _titles=titleArray;
41 |
42 | [self initData];
43 |
44 | [self initViews];
45 |
46 | self.block=block;
47 |
48 | }
49 |
50 | return self;
51 | }
52 |
53 | -(void)initData{
54 | _btn_w=0.0;
55 | if (_titles.countmaxOffsetX) {
119 | offsetX=maxOffsetX;
120 | }
121 |
122 | [UIView animateWithDuration:.2 animations:^{
123 |
124 | CGFloat lineW = [self.titlesStrWidthArray[btn.tag-1] floatValue];
125 | [_bgScrollView setContentOffset:CGPointMake(offsetX, 0) animated:YES];
126 | _selectLine.frame=CGRectMake(btn.frame.origin.x+(_btn_w-lineW)/2, self.frame.size.height-2, lineW, 2);
127 |
128 | } completion:^(BOOL finished) {
129 |
130 | }];
131 |
132 | }
133 |
134 | -(void)updateselectLineFrameWithoffset:(CGFloat)offsetx{
135 | // NSLog(@"====%f",offsetx);
136 | for (UIButton *btn in _btns) {
137 |
138 | if (btn.tag-1==_defaultIndex-1) {
139 | _titleBtn=btn;
140 |
141 | CGFloat w = [self.titlesStrWidthArray[btn.tag-1] floatValue];//字的宽度
142 | CGFloat line_x = (_btn_w-w)/2+(btn.tag-1)*_btn_w;
143 | CGFloat nextw=0;
144 | if (offsetx<(btn.tag-1)*windowContentWidth) {
145 | NSLog(@"向左");
146 | nextw = [self.titlesStrWidthArray[btn.tag-2] floatValue];
147 | CGFloat max_w = (_btn_w*2 + w +nextw)/2;
148 | CGFloat endoffsetx = (btn.tag-1)*windowContentWidth-offsetx;
149 |
150 | if (_selectLine.layer.width 0) {
197 | charIndex --;
198 | NSRange subStrRange = NSMakeRange(charIndex, 1);
199 | [reverseString appendString:[strSrc substringWithRange:subStrRange]];
200 | }
201 | return reverseString;
202 | }
203 | @end
204 |
--------------------------------------------------------------------------------
/LiuXSegment.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4B1ACD321CEAE68D0058BE98 /* LiuXSegmentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B1ACD311CEAE68D0058BE98 /* LiuXSegmentView.m */; };
11 | 4B1ACD351CEAE6A90058BE98 /* LXSegmentScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B1ACD341CEAE6A90058BE98 /* LXSegmentScrollView.m */; };
12 | 4B56317E1D76A83300204081 /* CALayer+LXAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B56317B1D76A83300204081 /* CALayer+LXAdd.m */; };
13 | 4B56317F1D76A83300204081 /* NSString+Size.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B56317D1D76A83300204081 /* NSString+Size.m */; };
14 | 4BA7409B1C9B9C28000A00BB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA7409A1C9B9C28000A00BB /* main.m */; };
15 | 4BA7409E1C9B9C28000A00BB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA7409D1C9B9C28000A00BB /* AppDelegate.m */; };
16 | 4BA740A11C9B9C28000A00BB /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA740A01C9B9C28000A00BB /* ViewController.m */; };
17 | 4BA740A41C9B9C28000A00BB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4BA740A21C9B9C28000A00BB /* Main.storyboard */; };
18 | 4BA740A61C9B9C28000A00BB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4BA740A51C9B9C28000A00BB /* Assets.xcassets */; };
19 | 4BA740A91C9B9C28000A00BB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4BA740A71C9B9C28000A00BB /* LaunchScreen.storyboard */; };
20 | 4BA740B41C9B9C28000A00BB /* LiuXSegmentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA740B31C9B9C28000A00BB /* LiuXSegmentTests.m */; };
21 | 4BA740BF1C9B9C28000A00BB /* LiuXSegmentUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BA740BE1C9B9C28000A00BB /* LiuXSegmentUITests.m */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXContainerItemProxy section */
25 | 4BA740B01C9B9C28000A00BB /* PBXContainerItemProxy */ = {
26 | isa = PBXContainerItemProxy;
27 | containerPortal = 4BA7408E1C9B9C28000A00BB /* Project object */;
28 | proxyType = 1;
29 | remoteGlobalIDString = 4BA740951C9B9C28000A00BB;
30 | remoteInfo = LiuXSegment;
31 | };
32 | 4BA740BB1C9B9C28000A00BB /* PBXContainerItemProxy */ = {
33 | isa = PBXContainerItemProxy;
34 | containerPortal = 4BA7408E1C9B9C28000A00BB /* Project object */;
35 | proxyType = 1;
36 | remoteGlobalIDString = 4BA740951C9B9C28000A00BB;
37 | remoteInfo = LiuXSegment;
38 | };
39 | /* End PBXContainerItemProxy section */
40 |
41 | /* Begin PBXFileReference section */
42 | 4B1ACD301CEAE68D0058BE98 /* LiuXSegmentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiuXSegmentView.h; sourceTree = ""; };
43 | 4B1ACD311CEAE68D0058BE98 /* LiuXSegmentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiuXSegmentView.m; sourceTree = ""; };
44 | 4B1ACD331CEAE6A90058BE98 /* LXSegmentScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LXSegmentScrollView.h; sourceTree = ""; };
45 | 4B1ACD341CEAE6A90058BE98 /* LXSegmentScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LXSegmentScrollView.m; sourceTree = ""; };
46 | 4B56317A1D76A83300204081 /* CALayer+LXAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+LXAdd.h"; sourceTree = ""; };
47 | 4B56317B1D76A83300204081 /* CALayer+LXAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer+LXAdd.m"; sourceTree = ""; };
48 | 4B56317C1D76A83300204081 /* NSString+Size.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Size.h"; sourceTree = ""; };
49 | 4B56317D1D76A83300204081 /* NSString+Size.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Size.m"; sourceTree = ""; };
50 | 4BA740961C9B9C28000A00BB /* LiuXSegment.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LiuXSegment.app; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 4BA7409A1C9B9C28000A00BB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
52 | 4BA7409C1C9B9C28000A00BB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
53 | 4BA7409D1C9B9C28000A00BB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
54 | 4BA7409F1C9B9C28000A00BB /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
55 | 4BA740A01C9B9C28000A00BB /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
56 | 4BA740A31C9B9C28000A00BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
57 | 4BA740A51C9B9C28000A00BB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
58 | 4BA740A81C9B9C28000A00BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
59 | 4BA740AA1C9B9C28000A00BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
60 | 4BA740AF1C9B9C28000A00BB /* LiuXSegmentTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LiuXSegmentTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
61 | 4BA740B31C9B9C28000A00BB /* LiuXSegmentTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LiuXSegmentTests.m; sourceTree = ""; };
62 | 4BA740B51C9B9C28000A00BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
63 | 4BA740BA1C9B9C28000A00BB /* LiuXSegmentUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LiuXSegmentUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
64 | 4BA740BE1C9B9C28000A00BB /* LiuXSegmentUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LiuXSegmentUITests.m; sourceTree = ""; };
65 | 4BA740C01C9B9C28000A00BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
66 | /* End PBXFileReference section */
67 |
68 | /* Begin PBXFrameworksBuildPhase section */
69 | 4BA740931C9B9C28000A00BB /* Frameworks */ = {
70 | isa = PBXFrameworksBuildPhase;
71 | buildActionMask = 2147483647;
72 | files = (
73 | );
74 | runOnlyForDeploymentPostprocessing = 0;
75 | };
76 | 4BA740AC1C9B9C28000A00BB /* Frameworks */ = {
77 | isa = PBXFrameworksBuildPhase;
78 | buildActionMask = 2147483647;
79 | files = (
80 | );
81 | runOnlyForDeploymentPostprocessing = 0;
82 | };
83 | 4BA740B71C9B9C28000A00BB /* Frameworks */ = {
84 | isa = PBXFrameworksBuildPhase;
85 | buildActionMask = 2147483647;
86 | files = (
87 | );
88 | runOnlyForDeploymentPostprocessing = 0;
89 | };
90 | /* End PBXFrameworksBuildPhase section */
91 |
92 | /* Begin PBXGroup section */
93 | 4B1ACD2F1CEAE68D0058BE98 /* LXSegment */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 4B5631791D76A81400204081 /* Category */,
97 | 4B1ACD301CEAE68D0058BE98 /* LiuXSegmentView.h */,
98 | 4B1ACD311CEAE68D0058BE98 /* LiuXSegmentView.m */,
99 | 4B1ACD331CEAE6A90058BE98 /* LXSegmentScrollView.h */,
100 | 4B1ACD341CEAE6A90058BE98 /* LXSegmentScrollView.m */,
101 | );
102 | path = LXSegment;
103 | sourceTree = "";
104 | };
105 | 4B5631791D76A81400204081 /* Category */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 4B56317A1D76A83300204081 /* CALayer+LXAdd.h */,
109 | 4B56317B1D76A83300204081 /* CALayer+LXAdd.m */,
110 | 4B56317C1D76A83300204081 /* NSString+Size.h */,
111 | 4B56317D1D76A83300204081 /* NSString+Size.m */,
112 | );
113 | path = Category;
114 | sourceTree = "";
115 | };
116 | 4BA7408D1C9B9C28000A00BB = {
117 | isa = PBXGroup;
118 | children = (
119 | 4BA740981C9B9C28000A00BB /* LiuXSegment */,
120 | 4BA740B21C9B9C28000A00BB /* LiuXSegmentTests */,
121 | 4BA740BD1C9B9C28000A00BB /* LiuXSegmentUITests */,
122 | 4BA740971C9B9C28000A00BB /* Products */,
123 | );
124 | sourceTree = "";
125 | };
126 | 4BA740971C9B9C28000A00BB /* Products */ = {
127 | isa = PBXGroup;
128 | children = (
129 | 4BA740961C9B9C28000A00BB /* LiuXSegment.app */,
130 | 4BA740AF1C9B9C28000A00BB /* LiuXSegmentTests.xctest */,
131 | 4BA740BA1C9B9C28000A00BB /* LiuXSegmentUITests.xctest */,
132 | );
133 | name = Products;
134 | sourceTree = "";
135 | };
136 | 4BA740981C9B9C28000A00BB /* LiuXSegment */ = {
137 | isa = PBXGroup;
138 | children = (
139 | 4B1ACD2F1CEAE68D0058BE98 /* LXSegment */,
140 | 4BA7409C1C9B9C28000A00BB /* AppDelegate.h */,
141 | 4BA7409D1C9B9C28000A00BB /* AppDelegate.m */,
142 | 4BA7409F1C9B9C28000A00BB /* ViewController.h */,
143 | 4BA740A01C9B9C28000A00BB /* ViewController.m */,
144 | 4BA740A21C9B9C28000A00BB /* Main.storyboard */,
145 | 4BA740A51C9B9C28000A00BB /* Assets.xcassets */,
146 | 4BA740A71C9B9C28000A00BB /* LaunchScreen.storyboard */,
147 | 4BA740AA1C9B9C28000A00BB /* Info.plist */,
148 | 4BA740991C9B9C28000A00BB /* Supporting Files */,
149 | );
150 | path = LiuXSegment;
151 | sourceTree = "";
152 | };
153 | 4BA740991C9B9C28000A00BB /* Supporting Files */ = {
154 | isa = PBXGroup;
155 | children = (
156 | 4BA7409A1C9B9C28000A00BB /* main.m */,
157 | );
158 | name = "Supporting Files";
159 | sourceTree = "";
160 | };
161 | 4BA740B21C9B9C28000A00BB /* LiuXSegmentTests */ = {
162 | isa = PBXGroup;
163 | children = (
164 | 4BA740B31C9B9C28000A00BB /* LiuXSegmentTests.m */,
165 | 4BA740B51C9B9C28000A00BB /* Info.plist */,
166 | );
167 | path = LiuXSegmentTests;
168 | sourceTree = "";
169 | };
170 | 4BA740BD1C9B9C28000A00BB /* LiuXSegmentUITests */ = {
171 | isa = PBXGroup;
172 | children = (
173 | 4BA740BE1C9B9C28000A00BB /* LiuXSegmentUITests.m */,
174 | 4BA740C01C9B9C28000A00BB /* Info.plist */,
175 | );
176 | path = LiuXSegmentUITests;
177 | sourceTree = "";
178 | };
179 | /* End PBXGroup section */
180 |
181 | /* Begin PBXNativeTarget section */
182 | 4BA740951C9B9C28000A00BB /* LiuXSegment */ = {
183 | isa = PBXNativeTarget;
184 | buildConfigurationList = 4BA740C31C9B9C28000A00BB /* Build configuration list for PBXNativeTarget "LiuXSegment" */;
185 | buildPhases = (
186 | 4BA740921C9B9C28000A00BB /* Sources */,
187 | 4BA740931C9B9C28000A00BB /* Frameworks */,
188 | 4BA740941C9B9C28000A00BB /* Resources */,
189 | );
190 | buildRules = (
191 | );
192 | dependencies = (
193 | );
194 | name = LiuXSegment;
195 | productName = LiuXSegment;
196 | productReference = 4BA740961C9B9C28000A00BB /* LiuXSegment.app */;
197 | productType = "com.apple.product-type.application";
198 | };
199 | 4BA740AE1C9B9C28000A00BB /* LiuXSegmentTests */ = {
200 | isa = PBXNativeTarget;
201 | buildConfigurationList = 4BA740C61C9B9C28000A00BB /* Build configuration list for PBXNativeTarget "LiuXSegmentTests" */;
202 | buildPhases = (
203 | 4BA740AB1C9B9C28000A00BB /* Sources */,
204 | 4BA740AC1C9B9C28000A00BB /* Frameworks */,
205 | 4BA740AD1C9B9C28000A00BB /* Resources */,
206 | );
207 | buildRules = (
208 | );
209 | dependencies = (
210 | 4BA740B11C9B9C28000A00BB /* PBXTargetDependency */,
211 | );
212 | name = LiuXSegmentTests;
213 | productName = LiuXSegmentTests;
214 | productReference = 4BA740AF1C9B9C28000A00BB /* LiuXSegmentTests.xctest */;
215 | productType = "com.apple.product-type.bundle.unit-test";
216 | };
217 | 4BA740B91C9B9C28000A00BB /* LiuXSegmentUITests */ = {
218 | isa = PBXNativeTarget;
219 | buildConfigurationList = 4BA740C91C9B9C28000A00BB /* Build configuration list for PBXNativeTarget "LiuXSegmentUITests" */;
220 | buildPhases = (
221 | 4BA740B61C9B9C28000A00BB /* Sources */,
222 | 4BA740B71C9B9C28000A00BB /* Frameworks */,
223 | 4BA740B81C9B9C28000A00BB /* Resources */,
224 | );
225 | buildRules = (
226 | );
227 | dependencies = (
228 | 4BA740BC1C9B9C28000A00BB /* PBXTargetDependency */,
229 | );
230 | name = LiuXSegmentUITests;
231 | productName = LiuXSegmentUITests;
232 | productReference = 4BA740BA1C9B9C28000A00BB /* LiuXSegmentUITests.xctest */;
233 | productType = "com.apple.product-type.bundle.ui-testing";
234 | };
235 | /* End PBXNativeTarget section */
236 |
237 | /* Begin PBXProject section */
238 | 4BA7408E1C9B9C28000A00BB /* Project object */ = {
239 | isa = PBXProject;
240 | attributes = {
241 | LastUpgradeCheck = 0720;
242 | ORGANIZATIONNAME = liuxin;
243 | TargetAttributes = {
244 | 4BA740951C9B9C28000A00BB = {
245 | CreatedOnToolsVersion = 7.2;
246 | };
247 | 4BA740AE1C9B9C28000A00BB = {
248 | CreatedOnToolsVersion = 7.2;
249 | TestTargetID = 4BA740951C9B9C28000A00BB;
250 | };
251 | 4BA740B91C9B9C28000A00BB = {
252 | CreatedOnToolsVersion = 7.2;
253 | TestTargetID = 4BA740951C9B9C28000A00BB;
254 | };
255 | };
256 | };
257 | buildConfigurationList = 4BA740911C9B9C28000A00BB /* Build configuration list for PBXProject "LiuXSegment" */;
258 | compatibilityVersion = "Xcode 3.2";
259 | developmentRegion = English;
260 | hasScannedForEncodings = 0;
261 | knownRegions = (
262 | en,
263 | Base,
264 | );
265 | mainGroup = 4BA7408D1C9B9C28000A00BB;
266 | productRefGroup = 4BA740971C9B9C28000A00BB /* Products */;
267 | projectDirPath = "";
268 | projectRoot = "";
269 | targets = (
270 | 4BA740951C9B9C28000A00BB /* LiuXSegment */,
271 | 4BA740AE1C9B9C28000A00BB /* LiuXSegmentTests */,
272 | 4BA740B91C9B9C28000A00BB /* LiuXSegmentUITests */,
273 | );
274 | };
275 | /* End PBXProject section */
276 |
277 | /* Begin PBXResourcesBuildPhase section */
278 | 4BA740941C9B9C28000A00BB /* Resources */ = {
279 | isa = PBXResourcesBuildPhase;
280 | buildActionMask = 2147483647;
281 | files = (
282 | 4BA740A91C9B9C28000A00BB /* LaunchScreen.storyboard in Resources */,
283 | 4BA740A61C9B9C28000A00BB /* Assets.xcassets in Resources */,
284 | 4BA740A41C9B9C28000A00BB /* Main.storyboard in Resources */,
285 | );
286 | runOnlyForDeploymentPostprocessing = 0;
287 | };
288 | 4BA740AD1C9B9C28000A00BB /* Resources */ = {
289 | isa = PBXResourcesBuildPhase;
290 | buildActionMask = 2147483647;
291 | files = (
292 | );
293 | runOnlyForDeploymentPostprocessing = 0;
294 | };
295 | 4BA740B81C9B9C28000A00BB /* Resources */ = {
296 | isa = PBXResourcesBuildPhase;
297 | buildActionMask = 2147483647;
298 | files = (
299 | );
300 | runOnlyForDeploymentPostprocessing = 0;
301 | };
302 | /* End PBXResourcesBuildPhase section */
303 |
304 | /* Begin PBXSourcesBuildPhase section */
305 | 4BA740921C9B9C28000A00BB /* Sources */ = {
306 | isa = PBXSourcesBuildPhase;
307 | buildActionMask = 2147483647;
308 | files = (
309 | 4B1ACD321CEAE68D0058BE98 /* LiuXSegmentView.m in Sources */,
310 | 4BA740A11C9B9C28000A00BB /* ViewController.m in Sources */,
311 | 4BA7409E1C9B9C28000A00BB /* AppDelegate.m in Sources */,
312 | 4B56317E1D76A83300204081 /* CALayer+LXAdd.m in Sources */,
313 | 4B56317F1D76A83300204081 /* NSString+Size.m in Sources */,
314 | 4BA7409B1C9B9C28000A00BB /* main.m in Sources */,
315 | 4B1ACD351CEAE6A90058BE98 /* LXSegmentScrollView.m in Sources */,
316 | );
317 | runOnlyForDeploymentPostprocessing = 0;
318 | };
319 | 4BA740AB1C9B9C28000A00BB /* Sources */ = {
320 | isa = PBXSourcesBuildPhase;
321 | buildActionMask = 2147483647;
322 | files = (
323 | 4BA740B41C9B9C28000A00BB /* LiuXSegmentTests.m in Sources */,
324 | );
325 | runOnlyForDeploymentPostprocessing = 0;
326 | };
327 | 4BA740B61C9B9C28000A00BB /* Sources */ = {
328 | isa = PBXSourcesBuildPhase;
329 | buildActionMask = 2147483647;
330 | files = (
331 | 4BA740BF1C9B9C28000A00BB /* LiuXSegmentUITests.m in Sources */,
332 | );
333 | runOnlyForDeploymentPostprocessing = 0;
334 | };
335 | /* End PBXSourcesBuildPhase section */
336 |
337 | /* Begin PBXTargetDependency section */
338 | 4BA740B11C9B9C28000A00BB /* PBXTargetDependency */ = {
339 | isa = PBXTargetDependency;
340 | target = 4BA740951C9B9C28000A00BB /* LiuXSegment */;
341 | targetProxy = 4BA740B01C9B9C28000A00BB /* PBXContainerItemProxy */;
342 | };
343 | 4BA740BC1C9B9C28000A00BB /* PBXTargetDependency */ = {
344 | isa = PBXTargetDependency;
345 | target = 4BA740951C9B9C28000A00BB /* LiuXSegment */;
346 | targetProxy = 4BA740BB1C9B9C28000A00BB /* PBXContainerItemProxy */;
347 | };
348 | /* End PBXTargetDependency section */
349 |
350 | /* Begin PBXVariantGroup section */
351 | 4BA740A21C9B9C28000A00BB /* Main.storyboard */ = {
352 | isa = PBXVariantGroup;
353 | children = (
354 | 4BA740A31C9B9C28000A00BB /* Base */,
355 | );
356 | name = Main.storyboard;
357 | sourceTree = "";
358 | };
359 | 4BA740A71C9B9C28000A00BB /* LaunchScreen.storyboard */ = {
360 | isa = PBXVariantGroup;
361 | children = (
362 | 4BA740A81C9B9C28000A00BB /* Base */,
363 | );
364 | name = LaunchScreen.storyboard;
365 | sourceTree = "";
366 | };
367 | /* End PBXVariantGroup section */
368 |
369 | /* Begin XCBuildConfiguration section */
370 | 4BA740C11C9B9C28000A00BB /* Debug */ = {
371 | isa = XCBuildConfiguration;
372 | buildSettings = {
373 | ALWAYS_SEARCH_USER_PATHS = NO;
374 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
375 | CLANG_CXX_LIBRARY = "libc++";
376 | CLANG_ENABLE_MODULES = YES;
377 | CLANG_ENABLE_OBJC_ARC = YES;
378 | CLANG_WARN_BOOL_CONVERSION = YES;
379 | CLANG_WARN_CONSTANT_CONVERSION = YES;
380 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
381 | CLANG_WARN_EMPTY_BODY = YES;
382 | CLANG_WARN_ENUM_CONVERSION = YES;
383 | CLANG_WARN_INT_CONVERSION = YES;
384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
385 | CLANG_WARN_UNREACHABLE_CODE = YES;
386 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
387 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
388 | COPY_PHASE_STRIP = NO;
389 | DEBUG_INFORMATION_FORMAT = dwarf;
390 | ENABLE_STRICT_OBJC_MSGSEND = YES;
391 | ENABLE_TESTABILITY = YES;
392 | GCC_C_LANGUAGE_STANDARD = gnu99;
393 | GCC_DYNAMIC_NO_PIC = NO;
394 | GCC_NO_COMMON_BLOCKS = YES;
395 | GCC_OPTIMIZATION_LEVEL = 0;
396 | GCC_PREPROCESSOR_DEFINITIONS = (
397 | "DEBUG=1",
398 | "$(inherited)",
399 | );
400 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
401 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
402 | GCC_WARN_UNDECLARED_SELECTOR = YES;
403 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
404 | GCC_WARN_UNUSED_FUNCTION = YES;
405 | GCC_WARN_UNUSED_VARIABLE = YES;
406 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
407 | MTL_ENABLE_DEBUG_INFO = YES;
408 | ONLY_ACTIVE_ARCH = YES;
409 | SDKROOT = iphoneos;
410 | };
411 | name = Debug;
412 | };
413 | 4BA740C21C9B9C28000A00BB /* Release */ = {
414 | isa = XCBuildConfiguration;
415 | buildSettings = {
416 | ALWAYS_SEARCH_USER_PATHS = NO;
417 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
418 | CLANG_CXX_LIBRARY = "libc++";
419 | CLANG_ENABLE_MODULES = YES;
420 | CLANG_ENABLE_OBJC_ARC = YES;
421 | CLANG_WARN_BOOL_CONVERSION = YES;
422 | CLANG_WARN_CONSTANT_CONVERSION = YES;
423 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
424 | CLANG_WARN_EMPTY_BODY = YES;
425 | CLANG_WARN_ENUM_CONVERSION = YES;
426 | CLANG_WARN_INT_CONVERSION = YES;
427 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
428 | CLANG_WARN_UNREACHABLE_CODE = YES;
429 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
430 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
431 | COPY_PHASE_STRIP = NO;
432 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
433 | ENABLE_NS_ASSERTIONS = NO;
434 | ENABLE_STRICT_OBJC_MSGSEND = YES;
435 | GCC_C_LANGUAGE_STANDARD = gnu99;
436 | GCC_NO_COMMON_BLOCKS = YES;
437 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
438 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
439 | GCC_WARN_UNDECLARED_SELECTOR = YES;
440 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
441 | GCC_WARN_UNUSED_FUNCTION = YES;
442 | GCC_WARN_UNUSED_VARIABLE = YES;
443 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
444 | MTL_ENABLE_DEBUG_INFO = NO;
445 | SDKROOT = iphoneos;
446 | VALIDATE_PRODUCT = YES;
447 | };
448 | name = Release;
449 | };
450 | 4BA740C41C9B9C28000A00BB /* Debug */ = {
451 | isa = XCBuildConfiguration;
452 | buildSettings = {
453 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
454 | INFOPLIST_FILE = LiuXSegment/Info.plist;
455 | IPHONEOS_DEPLOYMENT_TARGET = 8.1;
456 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
457 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LiuXSegment;
458 | PRODUCT_NAME = "$(TARGET_NAME)";
459 | };
460 | name = Debug;
461 | };
462 | 4BA740C51C9B9C28000A00BB /* Release */ = {
463 | isa = XCBuildConfiguration;
464 | buildSettings = {
465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
466 | INFOPLIST_FILE = LiuXSegment/Info.plist;
467 | IPHONEOS_DEPLOYMENT_TARGET = 8.1;
468 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
469 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LiuXSegment;
470 | PRODUCT_NAME = "$(TARGET_NAME)";
471 | };
472 | name = Release;
473 | };
474 | 4BA740C71C9B9C28000A00BB /* Debug */ = {
475 | isa = XCBuildConfiguration;
476 | buildSettings = {
477 | BUNDLE_LOADER = "$(TEST_HOST)";
478 | INFOPLIST_FILE = LiuXSegmentTests/Info.plist;
479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
480 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LiuXSegmentTests;
481 | PRODUCT_NAME = "$(TARGET_NAME)";
482 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LiuXSegment.app/LiuXSegment";
483 | };
484 | name = Debug;
485 | };
486 | 4BA740C81C9B9C28000A00BB /* Release */ = {
487 | isa = XCBuildConfiguration;
488 | buildSettings = {
489 | BUNDLE_LOADER = "$(TEST_HOST)";
490 | INFOPLIST_FILE = LiuXSegmentTests/Info.plist;
491 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
492 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LiuXSegmentTests;
493 | PRODUCT_NAME = "$(TARGET_NAME)";
494 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LiuXSegment.app/LiuXSegment";
495 | };
496 | name = Release;
497 | };
498 | 4BA740CA1C9B9C28000A00BB /* Debug */ = {
499 | isa = XCBuildConfiguration;
500 | buildSettings = {
501 | INFOPLIST_FILE = LiuXSegmentUITests/Info.plist;
502 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
503 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LiuXSegmentUITests;
504 | PRODUCT_NAME = "$(TARGET_NAME)";
505 | TEST_TARGET_NAME = LiuXSegment;
506 | USES_XCTRUNNER = YES;
507 | };
508 | name = Debug;
509 | };
510 | 4BA740CB1C9B9C28000A00BB /* Release */ = {
511 | isa = XCBuildConfiguration;
512 | buildSettings = {
513 | INFOPLIST_FILE = LiuXSegmentUITests/Info.plist;
514 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
515 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LiuXSegmentUITests;
516 | PRODUCT_NAME = "$(TARGET_NAME)";
517 | TEST_TARGET_NAME = LiuXSegment;
518 | USES_XCTRUNNER = YES;
519 | };
520 | name = Release;
521 | };
522 | /* End XCBuildConfiguration section */
523 |
524 | /* Begin XCConfigurationList section */
525 | 4BA740911C9B9C28000A00BB /* Build configuration list for PBXProject "LiuXSegment" */ = {
526 | isa = XCConfigurationList;
527 | buildConfigurations = (
528 | 4BA740C11C9B9C28000A00BB /* Debug */,
529 | 4BA740C21C9B9C28000A00BB /* Release */,
530 | );
531 | defaultConfigurationIsVisible = 0;
532 | defaultConfigurationName = Release;
533 | };
534 | 4BA740C31C9B9C28000A00BB /* Build configuration list for PBXNativeTarget "LiuXSegment" */ = {
535 | isa = XCConfigurationList;
536 | buildConfigurations = (
537 | 4BA740C41C9B9C28000A00BB /* Debug */,
538 | 4BA740C51C9B9C28000A00BB /* Release */,
539 | );
540 | defaultConfigurationIsVisible = 0;
541 | defaultConfigurationName = Release;
542 | };
543 | 4BA740C61C9B9C28000A00BB /* Build configuration list for PBXNativeTarget "LiuXSegmentTests" */ = {
544 | isa = XCConfigurationList;
545 | buildConfigurations = (
546 | 4BA740C71C9B9C28000A00BB /* Debug */,
547 | 4BA740C81C9B9C28000A00BB /* Release */,
548 | );
549 | defaultConfigurationIsVisible = 0;
550 | defaultConfigurationName = Release;
551 | };
552 | 4BA740C91C9B9C28000A00BB /* Build configuration list for PBXNativeTarget "LiuXSegmentUITests" */ = {
553 | isa = XCConfigurationList;
554 | buildConfigurations = (
555 | 4BA740CA1C9B9C28000A00BB /* Debug */,
556 | 4BA740CB1C9B9C28000A00BB /* Release */,
557 | );
558 | defaultConfigurationIsVisible = 0;
559 | defaultConfigurationName = Release;
560 | };
561 | /* End XCConfigurationList section */
562 | };
563 | rootObject = 4BA7408E1C9B9C28000A00BB /* Project object */;
564 | }
565 |
--------------------------------------------------------------------------------