├── .DS_Store ├── GuGuSegmentNavigationController ├── .DS_Store ├── GuGuLandscapeTableView.h ├── GuGuLandscapeTableView.m ├── GuGuSegmentBarView.h ├── GuGuSegmentBarView.m ├── GuGuSegmentNaviViewController.h └── GuGuSegmentNaviViewController.m ├── README.md └── Sample ├── .DS_Store ├── UISegmentNavigationTest.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── zc.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── zc.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── UISegmentNavigationTest.xcscheme │ └── xcschememanagement.plist ├── UISegmentNavigationTest ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── GuGuLandscapeTableView.h ├── GuGuLandscapeTableView.m ├── GuGuSegmentBarView.h ├── GuGuSegmentBarView.m ├── GuGuSegmentNaviViewController.h ├── GuGuSegmentNaviViewController.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── UISegmentNavigationTest-Info.plist ├── UISegmentNavigationTest-Prefix.pch ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m └── UISegmentNavigationTestTests ├── UISegmentNavigationTestTests-Info.plist ├── UISegmentNavigationTestTests.m └── en.lproj └── InfoPlist.strings /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gugupluto/GuGuSegmentNaviViewController/5c9b8d69ad2d089827ab2105207822d208907245/.DS_Store -------------------------------------------------------------------------------- /GuGuSegmentNavigationController/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gugupluto/GuGuSegmentNaviViewController/5c9b8d69ad2d089827ab2105207822d208907245/GuGuSegmentNavigationController/.DS_Store -------------------------------------------------------------------------------- /GuGuSegmentNavigationController/GuGuLandscapeTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuLandscapeTableView.h 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GuGuSegmentBarView.h" 11 | 12 | 13 | @interface GuGuLandscapeTableView : UIView 14 | { 15 | UITableView *tableView; 16 | } 17 | @property(nonatomic,retain)NSArray *cellDataSource; 18 | - (void)reloadTableWithArray:(NSArray*)array; 19 | - (id)initWithFrame:(CGRect)frame Array:(NSArray*)array; 20 | -(void)selectIndex:(int)index; 21 | 22 | @property(nonatomic,unsafe_unretained)idswipeDelegate; 23 | @end 24 | -------------------------------------------------------------------------------- /GuGuSegmentNavigationController/GuGuLandscapeTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuLandscapeTableView.m 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import "GuGuLandscapeTableView.h" 10 | 11 | @implementation GuGuLandscapeTableView 12 | @synthesize cellDataSource; 13 | @synthesize swipeDelegate; 14 | - (id)initWithFrame:(CGRect)frame Array:(NSArray*)array 15 | { 16 | self = [super init]; 17 | if (self) 18 | { 19 | self.frame = frame; 20 | 21 | self.backgroundColor = [UIColor redColor]; 22 | tableView = [[UITableView alloc]initWithFrame:self.bounds]; 23 | tableView.delegate = self; 24 | tableView.dataSource = self; 25 | tableView.scrollsToTop = NO; 26 | tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 27 | tableView.transform = CGAffineTransformMakeRotation(-M_PI/2); 28 | tableView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); 29 | tableView.showsVerticalScrollIndicator = NO; 30 | tableView.pagingEnabled = YES; 31 | tableView.backgroundColor = [UIColor colorWithRed:192/256.0 green:192/256.0 blue:192/256.0 alpha:1.0]; 32 | tableView.bounces =YES; 33 | [self addSubview:tableView]; 34 | self.cellDataSource = array; 35 | 36 | } 37 | return self; 38 | } 39 | 40 | 41 | - (void)reloadTableWithArray:(NSArray*)array 42 | { 43 | if (array && array.count >0) 44 | { 45 | self.cellDataSource = array; 46 | [tableView reloadData]; 47 | } 48 | } 49 | #pragma mark Table view methods 50 | 51 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 52 | { 53 | return self.frame.size.width; 54 | } 55 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 56 | { 57 | NSInteger rowCount = self.cellDataSource.count; 58 | 59 | return rowCount; 60 | } 61 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 62 | 63 | static NSString *CellIdentifier = @"ViewCell"; 64 | 65 | UITableViewCell *cell = nil; 66 | if (cell == nil) 67 | { 68 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier ] ; 69 | cell.contentView.backgroundColor=[UIColor clearColor]; 70 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 71 | cell.transform = CGAffineTransformMakeRotation(M_PI/2); 72 | 73 | UIViewController *vc = [cellDataSource objectAtIndex:[indexPath row]]; 74 | vc.view.frame = cell.bounds; 75 | [cell.contentView addSubview: vc.view]; 76 | } 77 | return cell; 78 | } 79 | 80 | -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView 81 | { 82 | if (self.swipeDelegate != nil && [self.swipeDelegate respondsToSelector:@selector(contentSelectedIndexChanged:)]) 83 | { 84 | int index = tableView.contentOffset.y / self.frame.size.width; 85 | [self.swipeDelegate contentSelectedIndexChanged:index]; 86 | } 87 | } 88 | 89 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 90 | { 91 | CGPoint pt = tableView.contentOffset; 92 | [self.swipeDelegate scrollOffsetChanged:pt]; 93 | } 94 | 95 | -(void)selectIndex:(int)index 96 | { 97 | [tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO]; 98 | } 99 | @end 100 | -------------------------------------------------------------------------------- /GuGuSegmentNavigationController/GuGuSegmentBarView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentBarView.h 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import 10 | #define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] 11 | 12 | @protocol GuGuIndexDelegate 13 | 14 | @optional 15 | -(void)barSelectedIndexChanged:(int)newIndex; 16 | -(void)contentSelectedIndexChanged:(int)newIndex; 17 | -(void)scrollOffsetChanged:(CGPoint)offset; 18 | 19 | @end 20 | @interface GuGuSegmentBarView : UIScrollView 21 | -(id)initWithFrame:(CGRect)frame andItems:(NSArray*)titleArray; 22 | -(void)setLineOffsetWithPage:(float)page andRatio:(float)ratio; 23 | -(void)selectIndex:(int)index; 24 | @property(nonatomic,assign)int selectedIndex; 25 | @property(nonatomic,unsafe_unretained)idclickDelegate; 26 | @end 27 | -------------------------------------------------------------------------------- /GuGuSegmentNavigationController/GuGuSegmentBarView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentBarView.m 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import "GuGuSegmentBarView.h" 10 | #define kButtonTagStart 100 11 | @interface GuGuSegmentBarView () 12 | { 13 | UIView *lineView; 14 | NSMutableArray *buttonArray; 15 | } 16 | @end 17 | 18 | @implementation GuGuSegmentBarView 19 | @synthesize selectedIndex; 20 | @synthesize clickDelegate; 21 | - (id)initWithFrame:(CGRect)frame 22 | { 23 | self = [super initWithFrame:frame]; 24 | if (self) { 25 | // Initialization code 26 | 27 | } 28 | return self; 29 | } 30 | 31 | -(id)initWithFrame:(CGRect)frame andItems:(NSArray*)titleArray 32 | { 33 | self = [super initWithFrame:frame]; 34 | if (self) { 35 | // Initialization code 36 | 37 | selectedIndex = 0; 38 | int width = 0; 39 | buttonArray = [[NSMutableArray alloc]init]; 40 | for (int i = 0 ; i < titleArray.count; i++) 41 | { 42 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 43 | button.backgroundColor = [UIColor clearColor]; 44 | button.titleLabel.font = [UIFont systemFontOfSize:15]; 45 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 46 | NSString *title = [titleArray objectAtIndex:i]; 47 | [button setTitle:title forState:UIControlStateNormal]; 48 | button.tag = kButtonTagStart+i; 49 | CGSize size = [title sizeWithFont:[UIFont systemFontOfSize:15] constrainedToSize:CGSizeMake(MAXFLOAT, 25) lineBreakMode:NSLineBreakByWordWrapping]; 50 | button.frame = CGRectMake(width, 0, size.width, 25); 51 | [button addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside]; 52 | [self addSubview:button]; 53 | [buttonArray addObject:button]; 54 | width += size.width+20; 55 | 56 | } 57 | self.contentSize = CGSizeMake(width, 25); 58 | self.showsHorizontalScrollIndicator = NO; 59 | 60 | 61 | CGRect rc = [self viewWithTag:selectedIndex+kButtonTagStart].frame; 62 | lineView = [[UIView alloc]initWithFrame:CGRectMake(rc.origin.x, self.frame.size.height - 2, rc.size.width, 2)]; 63 | lineView.backgroundColor = RGBCOLOR(190, 2, 1); 64 | [self addSubview:lineView]; 65 | } 66 | return self; 67 | 68 | 69 | 70 | } 71 | 72 | -(void)onClick:(id)sender 73 | { 74 | UIButton *btn = (UIButton*)sender; 75 | if (selectedIndex != btn.tag - kButtonTagStart) 76 | { 77 | [self selectIndex:(int)(btn.tag - kButtonTagStart)]; 78 | } 79 | 80 | } 81 | 82 | -(void)selectIndex:(int)index 83 | { 84 | if (selectedIndex != index) 85 | { 86 | selectedIndex = index; 87 | [UIView beginAnimations:@"" context:nil]; 88 | [UIView setAnimationDuration:0.2]; 89 | CGRect lineRC = [self viewWithTag:selectedIndex+kButtonTagStart].frame; 90 | lineView.frame = CGRectMake(lineRC.origin.x, self.frame.size.height - 2, lineRC.size.width, 2); 91 | [UIView commitAnimations]; 92 | 93 | if (clickDelegate != nil && [clickDelegate respondsToSelector:@selector(barSelectedIndexChanged:)]) 94 | { 95 | [clickDelegate barSelectedIndexChanged:selectedIndex]; 96 | } 97 | 98 | 99 | if (lineRC.origin.x - self.contentOffset.x > 320 * 2 / 3) 100 | { 101 | int index = selectedIndex; 102 | if (selectedIndex + 2 < buttonArray.count) 103 | { 104 | index = selectedIndex + 2; 105 | } 106 | else if (selectedIndex + 1 < buttonArray.count) 107 | { 108 | index = selectedIndex + 1; 109 | } 110 | CGRect rc = [self viewWithTag:index +kButtonTagStart].frame; 111 | [self scrollRectToVisible:rc animated:YES]; 112 | } 113 | else if ( lineRC.origin.x - self.contentOffset.x < 320 / 3) 114 | { 115 | int index = selectedIndex; 116 | if (selectedIndex - 2 >= 0) 117 | { 118 | index = selectedIndex - 2; 119 | } 120 | else if (selectedIndex - 1 >= 0) 121 | { 122 | index = selectedIndex - 1; 123 | } 124 | CGRect rc = [self viewWithTag:index +kButtonTagStart].frame; 125 | [self scrollRectToVisible:rc animated:YES]; 126 | } 127 | 128 | 129 | } 130 | 131 | } 132 | 133 | -(void)setLineOffsetWithPage:(float)page andRatio:(float)ratio 134 | { 135 | 136 | 137 | CGRect lineRC = [self viewWithTag:page+kButtonTagStart].frame; 138 | 139 | CGRect lineRC2 = [self viewWithTag:page+1+kButtonTagStart].frame; 140 | 141 | float width = lineRC2.size.width; 142 | if (lineRC2.size.width < lineRC.size.width) 143 | { 144 | width = lineRC.size.width - (lineRC.size.width-lineRC2.size.width)*ratio; 145 | 146 | } 147 | else if(lineRC2.size.width > lineRC.size.width) 148 | { 149 | width = lineRC.size.width + (lineRC2.size.width-lineRC.size.width)*ratio; 150 | } 151 | float x = lineRC.origin.x + (lineRC2.origin.x - lineRC.origin.x)*ratio; 152 | 153 | 154 | lineView.frame = CGRectMake(x, self.frame.size.height - 2,width, 2); 155 | 156 | 157 | 158 | } 159 | 160 | 161 | 162 | 163 | /* 164 | // Only override drawRect: if you perform custom drawing. 165 | // An empty implementation adversely affects performance during animation. 166 | - (void)drawRect:(CGRect)rect 167 | { 168 | // Drawing code 169 | } 170 | */ 171 | 172 | @end 173 | -------------------------------------------------------------------------------- /GuGuSegmentNavigationController/GuGuSegmentNaviViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentNaviViewController.h 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GuGuSegmentBarView.h" 11 | @interface GuGuSegmentNaviViewController : UIViewController 12 | { 13 | 14 | } 15 | -(id)initWithItems:(NSArray*)titleArray andControllers:(NSArray*)controllers; 16 | @end 17 | -------------------------------------------------------------------------------- /GuGuSegmentNavigationController/GuGuSegmentNaviViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentNaviViewController.m 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import "GuGuSegmentNaviViewController.h" 10 | #import "GuGuSegmentBarView.h" 11 | #import "GuGuLandscapeTableView.h" 12 | 13 | #define kBarHeight 27 14 | @interface GuGuSegmentNaviViewController () 15 | { 16 | int currentIndex; 17 | NSArray *_titleArray; 18 | GuGuLandscapeTableView *contentTable; 19 | GuGuSegmentBarView *barView ; 20 | } 21 | @end 22 | 23 | @implementation GuGuSegmentNaviViewController 24 | 25 | -(id)initWithItems:(NSArray*)titleArray andControllers:(NSArray*)controllers 26 | { 27 | self = [super init]; 28 | if (self) 29 | { 30 | NSString * tmpVersonType = [UIDevice currentDevice].systemVersion; 31 | 32 | NSArray * tmpArr = [tmpVersonType componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"."]]; 33 | int y = 0; 34 | if([[tmpArr objectAtIndex:0] isEqualToString:@"7"]) 35 | { 36 | self.automaticallyAdjustsScrollViewInsets = NO; 37 | y = 64; 38 | } 39 | 40 | barView = [[GuGuSegmentBarView alloc]initWithFrame:CGRectMake(0, y, 320, kBarHeight) andItems:titleArray]; 41 | 42 | barView.backgroundColor = RGBCOLOR(230, 230, 230); 43 | [self.view addSubview:barView]; 44 | barView.clickDelegate = self; 45 | self.view.backgroundColor = [UIColor whiteColor]; 46 | contentTable = [[GuGuLandscapeTableView alloc]initWithFrame:CGRectMake(0, kBarHeight + y, 320, self.view.frame.size.height - kBarHeight - y) Array:controllers]; 47 | contentTable.swipeDelegate = self; 48 | 49 | [self.view addSubview:contentTable]; 50 | 51 | 52 | if (controllers.count > 0) 53 | { 54 | for (UIViewController *controller in controllers) 55 | { 56 | //[self addChildViewController:controller]; 57 | } 58 | currentIndex = 0; 59 | } 60 | _titleArray = titleArray; 61 | } 62 | return self; 63 | } 64 | 65 | 66 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 67 | { 68 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 69 | if (self) { 70 | // Custom initialization 71 | 72 | } 73 | return self; 74 | } 75 | 76 | - (void)viewDidLoad 77 | { 78 | [super viewDidLoad]; 79 | self.title = [_titleArray objectAtIndex:0]; 80 | 81 | // Do any additional setup after loading the view. 82 | } 83 | 84 | - (void)didReceiveMemoryWarning 85 | { 86 | [super didReceiveMemoryWarning]; 87 | // Dispose of any resources that can be recreated. 88 | } 89 | 90 | -(void)barSelectedIndexChanged:(int)newIndex 91 | { 92 | if (newIndex >= 0) 93 | { 94 | currentIndex = newIndex; 95 | self.title = [_titleArray objectAtIndex:newIndex]; 96 | [contentTable selectIndex:newIndex]; 97 | } 98 | } 99 | 100 | -(void)contentSelectedIndexChanged:(int)newIndex 101 | { 102 | [barView selectIndex:newIndex]; 103 | } 104 | 105 | -(void)scrollOffsetChanged:(CGPoint)offset 106 | { 107 | int page = (int)offset.y / 320 ; 108 | float radio = (float)((int)offset.y % 320)/320; 109 | [barView setLineOffsetWithPage:page andRatio:radio]; 110 | } 111 | 112 | 113 | 114 | 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | GuGuSegmentNaviViewController 2 | ============================= 3 | 4 | 一个仿网易新闻客户端iPhone版的标签式导航ViewController 5 | 效果与网易新闻客户端的标签式导航基本一样: 6 | (1)点击上面的标签,可以显示对应的controller,标签下面的红色提示条的长度会动态变化。 7 | (2)对下面的内容区左滑或者右滑可以显示对应的controller,标签会同时变化。 8 | -------------------------------------------------------------------------------- /Sample/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gugupluto/GuGuSegmentNaviViewController/5c9b8d69ad2d089827ab2105207822d208907245/Sample/.DS_Store -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 598791E818B71E9600C03676 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 598791E718B71E9600C03676 /* Foundation.framework */; }; 11 | 598791EA18B71E9600C03676 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 598791E918B71E9600C03676 /* CoreGraphics.framework */; }; 12 | 598791EC18B71E9600C03676 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 598791EB18B71E9600C03676 /* UIKit.framework */; }; 13 | 598791F218B71E9600C03676 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 598791F018B71E9600C03676 /* InfoPlist.strings */; }; 14 | 598791F418B71E9600C03676 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 598791F318B71E9600C03676 /* main.m */; }; 15 | 598791F818B71E9600C03676 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 598791F718B71E9600C03676 /* AppDelegate.m */; }; 16 | 598791FB18B71E9600C03676 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 598791F918B71E9600C03676 /* Main.storyboard */; }; 17 | 598791FE18B71E9600C03676 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 598791FD18B71E9600C03676 /* ViewController.m */; }; 18 | 5987920018B71E9600C03676 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 598791FF18B71E9600C03676 /* Images.xcassets */; }; 19 | 5987920718B71E9600C03676 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5987920618B71E9600C03676 /* XCTest.framework */; }; 20 | 5987920818B71E9600C03676 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 598791E718B71E9600C03676 /* Foundation.framework */; }; 21 | 5987920918B71E9600C03676 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 598791EB18B71E9600C03676 /* UIKit.framework */; }; 22 | 5987921118B71E9600C03676 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5987920F18B71E9600C03676 /* InfoPlist.strings */; }; 23 | 5987921318B71E9600C03676 /* UISegmentNavigationTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5987921218B71E9600C03676 /* UISegmentNavigationTestTests.m */; }; 24 | 5987921E18B71ED600C03676 /* GuGuSegmentNaviViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5987921D18B71ED600C03676 /* GuGuSegmentNaviViewController.m */; }; 25 | 5987922118B721DF00C03676 /* GuGuSegmentBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5987922018B721DF00C03676 /* GuGuSegmentBarView.m */; }; 26 | 5987922A18B749F100C03676 /* GuGuLandscapeTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5987922918B749F100C03676 /* GuGuLandscapeTableView.m */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXContainerItemProxy section */ 30 | 5987920A18B71E9600C03676 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 598791DC18B71E9600C03676 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 598791E318B71E9600C03676; 35 | remoteInfo = UISegmentNavigationTest; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 598791E418B71E9600C03676 /* UISegmentNavigationTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UISegmentNavigationTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 598791E718B71E9600C03676 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 42 | 598791E918B71E9600C03676 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 43 | 598791EB18B71E9600C03676 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 44 | 598791EF18B71E9600C03676 /* UISegmentNavigationTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UISegmentNavigationTest-Info.plist"; sourceTree = ""; }; 45 | 598791F118B71E9600C03676 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 46 | 598791F318B71E9600C03676 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | 598791F518B71E9600C03676 /* UISegmentNavigationTest-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UISegmentNavigationTest-Prefix.pch"; sourceTree = ""; }; 48 | 598791F618B71E9600C03676 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 49 | 598791F718B71E9600C03676 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 50 | 598791FA18B71E9600C03676 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 598791FC18B71E9600C03676 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 52 | 598791FD18B71E9600C03676 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 53 | 598791FF18B71E9600C03676 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 54 | 5987920518B71E9600C03676 /* UISegmentNavigationTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UISegmentNavigationTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 5987920618B71E9600C03676 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 56 | 5987920E18B71E9600C03676 /* UISegmentNavigationTestTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UISegmentNavigationTestTests-Info.plist"; sourceTree = ""; }; 57 | 5987921018B71E9600C03676 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 58 | 5987921218B71E9600C03676 /* UISegmentNavigationTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UISegmentNavigationTestTests.m; sourceTree = ""; }; 59 | 5987921C18B71ED600C03676 /* GuGuSegmentNaviViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GuGuSegmentNaviViewController.h; sourceTree = ""; }; 60 | 5987921D18B71ED600C03676 /* GuGuSegmentNaviViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GuGuSegmentNaviViewController.m; sourceTree = ""; }; 61 | 5987921F18B721DF00C03676 /* GuGuSegmentBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GuGuSegmentBarView.h; sourceTree = ""; }; 62 | 5987922018B721DF00C03676 /* GuGuSegmentBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GuGuSegmentBarView.m; sourceTree = ""; }; 63 | 5987922818B749F100C03676 /* GuGuLandscapeTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GuGuLandscapeTableView.h; sourceTree = ""; }; 64 | 5987922918B749F100C03676 /* GuGuLandscapeTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GuGuLandscapeTableView.m; sourceTree = ""; }; 65 | /* End PBXFileReference section */ 66 | 67 | /* Begin PBXFrameworksBuildPhase section */ 68 | 598791E118B71E9600C03676 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | 598791EA18B71E9600C03676 /* CoreGraphics.framework in Frameworks */, 73 | 598791EC18B71E9600C03676 /* UIKit.framework in Frameworks */, 74 | 598791E818B71E9600C03676 /* Foundation.framework in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | 5987920218B71E9600C03676 /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | 5987920718B71E9600C03676 /* XCTest.framework in Frameworks */, 83 | 5987920918B71E9600C03676 /* UIKit.framework in Frameworks */, 84 | 5987920818B71E9600C03676 /* Foundation.framework in Frameworks */, 85 | ); 86 | runOnlyForDeploymentPostprocessing = 0; 87 | }; 88 | /* End PBXFrameworksBuildPhase section */ 89 | 90 | /* Begin PBXGroup section */ 91 | 598791DB18B71E9600C03676 = { 92 | isa = PBXGroup; 93 | children = ( 94 | 598791ED18B71E9600C03676 /* UISegmentNavigationTest */, 95 | 5987920C18B71E9600C03676 /* UISegmentNavigationTestTests */, 96 | 598791E618B71E9600C03676 /* Frameworks */, 97 | 598791E518B71E9600C03676 /* Products */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | 598791E518B71E9600C03676 /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 598791E418B71E9600C03676 /* UISegmentNavigationTest.app */, 105 | 5987920518B71E9600C03676 /* UISegmentNavigationTestTests.xctest */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | 598791E618B71E9600C03676 /* Frameworks */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 598791E718B71E9600C03676 /* Foundation.framework */, 114 | 598791E918B71E9600C03676 /* CoreGraphics.framework */, 115 | 598791EB18B71E9600C03676 /* UIKit.framework */, 116 | 5987920618B71E9600C03676 /* XCTest.framework */, 117 | ); 118 | name = Frameworks; 119 | sourceTree = ""; 120 | }; 121 | 598791ED18B71E9600C03676 /* UISegmentNavigationTest */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 5987922818B749F100C03676 /* GuGuLandscapeTableView.h */, 125 | 5987922918B749F100C03676 /* GuGuLandscapeTableView.m */, 126 | 5987921C18B71ED600C03676 /* GuGuSegmentNaviViewController.h */, 127 | 5987921D18B71ED600C03676 /* GuGuSegmentNaviViewController.m */, 128 | 598791F618B71E9600C03676 /* AppDelegate.h */, 129 | 598791F718B71E9600C03676 /* AppDelegate.m */, 130 | 598791F918B71E9600C03676 /* Main.storyboard */, 131 | 598791FC18B71E9600C03676 /* ViewController.h */, 132 | 598791FD18B71E9600C03676 /* ViewController.m */, 133 | 598791FF18B71E9600C03676 /* Images.xcassets */, 134 | 598791EE18B71E9600C03676 /* Supporting Files */, 135 | 5987921F18B721DF00C03676 /* GuGuSegmentBarView.h */, 136 | 5987922018B721DF00C03676 /* GuGuSegmentBarView.m */, 137 | ); 138 | path = UISegmentNavigationTest; 139 | sourceTree = ""; 140 | }; 141 | 598791EE18B71E9600C03676 /* Supporting Files */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 598791EF18B71E9600C03676 /* UISegmentNavigationTest-Info.plist */, 145 | 598791F018B71E9600C03676 /* InfoPlist.strings */, 146 | 598791F318B71E9600C03676 /* main.m */, 147 | 598791F518B71E9600C03676 /* UISegmentNavigationTest-Prefix.pch */, 148 | ); 149 | name = "Supporting Files"; 150 | sourceTree = ""; 151 | }; 152 | 5987920C18B71E9600C03676 /* UISegmentNavigationTestTests */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 5987921218B71E9600C03676 /* UISegmentNavigationTestTests.m */, 156 | 5987920D18B71E9600C03676 /* Supporting Files */, 157 | ); 158 | path = UISegmentNavigationTestTests; 159 | sourceTree = ""; 160 | }; 161 | 5987920D18B71E9600C03676 /* Supporting Files */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 5987920E18B71E9600C03676 /* UISegmentNavigationTestTests-Info.plist */, 165 | 5987920F18B71E9600C03676 /* InfoPlist.strings */, 166 | ); 167 | name = "Supporting Files"; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXGroup section */ 171 | 172 | /* Begin PBXNativeTarget section */ 173 | 598791E318B71E9600C03676 /* UISegmentNavigationTest */ = { 174 | isa = PBXNativeTarget; 175 | buildConfigurationList = 5987921618B71E9600C03676 /* Build configuration list for PBXNativeTarget "UISegmentNavigationTest" */; 176 | buildPhases = ( 177 | 598791E018B71E9600C03676 /* Sources */, 178 | 598791E118B71E9600C03676 /* Frameworks */, 179 | 598791E218B71E9600C03676 /* Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = UISegmentNavigationTest; 186 | productName = UISegmentNavigationTest; 187 | productReference = 598791E418B71E9600C03676 /* UISegmentNavigationTest.app */; 188 | productType = "com.apple.product-type.application"; 189 | }; 190 | 5987920418B71E9600C03676 /* UISegmentNavigationTestTests */ = { 191 | isa = PBXNativeTarget; 192 | buildConfigurationList = 5987921918B71E9600C03676 /* Build configuration list for PBXNativeTarget "UISegmentNavigationTestTests" */; 193 | buildPhases = ( 194 | 5987920118B71E9600C03676 /* Sources */, 195 | 5987920218B71E9600C03676 /* Frameworks */, 196 | 5987920318B71E9600C03676 /* Resources */, 197 | ); 198 | buildRules = ( 199 | ); 200 | dependencies = ( 201 | 5987920B18B71E9600C03676 /* PBXTargetDependency */, 202 | ); 203 | name = UISegmentNavigationTestTests; 204 | productName = UISegmentNavigationTestTests; 205 | productReference = 5987920518B71E9600C03676 /* UISegmentNavigationTestTests.xctest */; 206 | productType = "com.apple.product-type.bundle.unit-test"; 207 | }; 208 | /* End PBXNativeTarget section */ 209 | 210 | /* Begin PBXProject section */ 211 | 598791DC18B71E9600C03676 /* Project object */ = { 212 | isa = PBXProject; 213 | attributes = { 214 | LastUpgradeCheck = 0500; 215 | ORGANIZATIONNAME = zc; 216 | TargetAttributes = { 217 | 5987920418B71E9600C03676 = { 218 | TestTargetID = 598791E318B71E9600C03676; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = 598791DF18B71E9600C03676 /* Build configuration list for PBXProject "UISegmentNavigationTest" */; 223 | compatibilityVersion = "Xcode 3.2"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | Base, 229 | ); 230 | mainGroup = 598791DB18B71E9600C03676; 231 | productRefGroup = 598791E518B71E9600C03676 /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | 598791E318B71E9600C03676 /* UISegmentNavigationTest */, 236 | 5987920418B71E9600C03676 /* UISegmentNavigationTestTests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 598791E218B71E9600C03676 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 5987920018B71E9600C03676 /* Images.xcassets in Resources */, 247 | 598791F218B71E9600C03676 /* InfoPlist.strings in Resources */, 248 | 598791FB18B71E9600C03676 /* Main.storyboard in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | 5987920318B71E9600C03676 /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | 5987921118B71E9600C03676 /* InfoPlist.strings in Resources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | /* End PBXResourcesBuildPhase section */ 261 | 262 | /* Begin PBXSourcesBuildPhase section */ 263 | 598791E018B71E9600C03676 /* Sources */ = { 264 | isa = PBXSourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 5987922A18B749F100C03676 /* GuGuLandscapeTableView.m in Sources */, 268 | 5987922118B721DF00C03676 /* GuGuSegmentBarView.m in Sources */, 269 | 598791FE18B71E9600C03676 /* ViewController.m in Sources */, 270 | 598791F818B71E9600C03676 /* AppDelegate.m in Sources */, 271 | 5987921E18B71ED600C03676 /* GuGuSegmentNaviViewController.m in Sources */, 272 | 598791F418B71E9600C03676 /* main.m in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 5987920118B71E9600C03676 /* Sources */ = { 277 | isa = PBXSourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | 5987921318B71E9600C03676 /* UISegmentNavigationTestTests.m in Sources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXSourcesBuildPhase section */ 285 | 286 | /* Begin PBXTargetDependency section */ 287 | 5987920B18B71E9600C03676 /* PBXTargetDependency */ = { 288 | isa = PBXTargetDependency; 289 | target = 598791E318B71E9600C03676 /* UISegmentNavigationTest */; 290 | targetProxy = 5987920A18B71E9600C03676 /* PBXContainerItemProxy */; 291 | }; 292 | /* End PBXTargetDependency section */ 293 | 294 | /* Begin PBXVariantGroup section */ 295 | 598791F018B71E9600C03676 /* InfoPlist.strings */ = { 296 | isa = PBXVariantGroup; 297 | children = ( 298 | 598791F118B71E9600C03676 /* en */, 299 | ); 300 | name = InfoPlist.strings; 301 | sourceTree = ""; 302 | }; 303 | 598791F918B71E9600C03676 /* Main.storyboard */ = { 304 | isa = PBXVariantGroup; 305 | children = ( 306 | 598791FA18B71E9600C03676 /* Base */, 307 | ); 308 | name = Main.storyboard; 309 | sourceTree = ""; 310 | }; 311 | 5987920F18B71E9600C03676 /* InfoPlist.strings */ = { 312 | isa = PBXVariantGroup; 313 | children = ( 314 | 5987921018B71E9600C03676 /* en */, 315 | ); 316 | name = InfoPlist.strings; 317 | sourceTree = ""; 318 | }; 319 | /* End PBXVariantGroup section */ 320 | 321 | /* Begin XCBuildConfiguration section */ 322 | 5987921418B71E9600C03676 /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 327 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 328 | CLANG_CXX_LIBRARY = "libc++"; 329 | CLANG_ENABLE_MODULES = YES; 330 | CLANG_ENABLE_OBJC_ARC = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_EMPTY_BODY = YES; 335 | CLANG_WARN_ENUM_CONVERSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | GCC_C_LANGUAGE_STANDARD = gnu99; 342 | GCC_DYNAMIC_NO_PIC = NO; 343 | GCC_OPTIMIZATION_LEVEL = 0; 344 | GCC_PREPROCESSOR_DEFINITIONS = ( 345 | "DEBUG=1", 346 | "$(inherited)", 347 | ); 348 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 351 | GCC_WARN_UNDECLARED_SELECTOR = YES; 352 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 353 | GCC_WARN_UNUSED_FUNCTION = YES; 354 | GCC_WARN_UNUSED_VARIABLE = YES; 355 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 356 | ONLY_ACTIVE_ARCH = YES; 357 | SDKROOT = iphoneos; 358 | }; 359 | name = Debug; 360 | }; 361 | 5987921518B71E9600C03676 /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ALWAYS_SEARCH_USER_PATHS = NO; 365 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 366 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 367 | CLANG_CXX_LIBRARY = "libc++"; 368 | CLANG_ENABLE_MODULES = YES; 369 | CLANG_ENABLE_OBJC_ARC = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_CONSTANT_CONVERSION = YES; 372 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 373 | CLANG_WARN_EMPTY_BODY = YES; 374 | CLANG_WARN_ENUM_CONVERSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 377 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 378 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 379 | COPY_PHASE_STRIP = YES; 380 | ENABLE_NS_ASSERTIONS = NO; 381 | GCC_C_LANGUAGE_STANDARD = gnu99; 382 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 383 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 384 | GCC_WARN_UNDECLARED_SELECTOR = YES; 385 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 386 | GCC_WARN_UNUSED_FUNCTION = YES; 387 | GCC_WARN_UNUSED_VARIABLE = YES; 388 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 389 | SDKROOT = iphoneos; 390 | VALIDATE_PRODUCT = YES; 391 | }; 392 | name = Release; 393 | }; 394 | 5987921718B71E9600C03676 /* Debug */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 398 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 399 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 400 | GCC_PREFIX_HEADER = "UISegmentNavigationTest/UISegmentNavigationTest-Prefix.pch"; 401 | INFOPLIST_FILE = "UISegmentNavigationTest/UISegmentNavigationTest-Info.plist"; 402 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 403 | PRODUCT_NAME = "$(TARGET_NAME)"; 404 | WRAPPER_EXTENSION = app; 405 | }; 406 | name = Debug; 407 | }; 408 | 5987921818B71E9600C03676 /* Release */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 412 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 413 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 414 | GCC_PREFIX_HEADER = "UISegmentNavigationTest/UISegmentNavigationTest-Prefix.pch"; 415 | INFOPLIST_FILE = "UISegmentNavigationTest/UISegmentNavigationTest-Info.plist"; 416 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | WRAPPER_EXTENSION = app; 419 | }; 420 | name = Release; 421 | }; 422 | 5987921A18B71E9600C03676 /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 426 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UISegmentNavigationTest.app/UISegmentNavigationTest"; 427 | FRAMEWORK_SEARCH_PATHS = ( 428 | "$(SDKROOT)/Developer/Library/Frameworks", 429 | "$(inherited)", 430 | "$(DEVELOPER_FRAMEWORKS_DIR)", 431 | ); 432 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 433 | GCC_PREFIX_HEADER = "UISegmentNavigationTest/UISegmentNavigationTest-Prefix.pch"; 434 | GCC_PREPROCESSOR_DEFINITIONS = ( 435 | "DEBUG=1", 436 | "$(inherited)", 437 | ); 438 | INFOPLIST_FILE = "UISegmentNavigationTestTests/UISegmentNavigationTestTests-Info.plist"; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | TEST_HOST = "$(BUNDLE_LOADER)"; 441 | WRAPPER_EXTENSION = xctest; 442 | }; 443 | name = Debug; 444 | }; 445 | 5987921B18B71E9600C03676 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 449 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UISegmentNavigationTest.app/UISegmentNavigationTest"; 450 | FRAMEWORK_SEARCH_PATHS = ( 451 | "$(SDKROOT)/Developer/Library/Frameworks", 452 | "$(inherited)", 453 | "$(DEVELOPER_FRAMEWORKS_DIR)", 454 | ); 455 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 456 | GCC_PREFIX_HEADER = "UISegmentNavigationTest/UISegmentNavigationTest-Prefix.pch"; 457 | INFOPLIST_FILE = "UISegmentNavigationTestTests/UISegmentNavigationTestTests-Info.plist"; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | TEST_HOST = "$(BUNDLE_LOADER)"; 460 | WRAPPER_EXTENSION = xctest; 461 | }; 462 | name = Release; 463 | }; 464 | /* End XCBuildConfiguration section */ 465 | 466 | /* Begin XCConfigurationList section */ 467 | 598791DF18B71E9600C03676 /* Build configuration list for PBXProject "UISegmentNavigationTest" */ = { 468 | isa = XCConfigurationList; 469 | buildConfigurations = ( 470 | 5987921418B71E9600C03676 /* Debug */, 471 | 5987921518B71E9600C03676 /* Release */, 472 | ); 473 | defaultConfigurationIsVisible = 0; 474 | defaultConfigurationName = Release; 475 | }; 476 | 5987921618B71E9600C03676 /* Build configuration list for PBXNativeTarget "UISegmentNavigationTest" */ = { 477 | isa = XCConfigurationList; 478 | buildConfigurations = ( 479 | 5987921718B71E9600C03676 /* Debug */, 480 | 5987921818B71E9600C03676 /* Release */, 481 | ); 482 | defaultConfigurationIsVisible = 0; 483 | }; 484 | 5987921918B71E9600C03676 /* Build configuration list for PBXNativeTarget "UISegmentNavigationTestTests" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | 5987921A18B71E9600C03676 /* Debug */, 488 | 5987921B18B71E9600C03676 /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | }; 492 | /* End XCConfigurationList section */ 493 | }; 494 | rootObject = 598791DC18B71E9600C03676 /* Project object */; 495 | } 496 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest.xcodeproj/project.xcworkspace/xcuserdata/zc.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gugupluto/GuGuSegmentNaviViewController/5c9b8d69ad2d089827ab2105207822d208907245/Sample/UISegmentNavigationTest.xcodeproj/project.xcworkspace/xcuserdata/zc.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest.xcodeproj/xcuserdata/zc.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest.xcodeproj/xcuserdata/zc.xcuserdatad/xcschemes/UISegmentNavigationTest.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest.xcodeproj/xcuserdata/zc.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | UISegmentNavigationTest.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 598791E318B71E9600C03676 16 | 17 | primary 18 | 19 | 20 | 5987920418B71E9600C03676 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // UISegmentNavigationTest 4 | // 5 | // Created by gugupluto on 14-2-21. 6 | // http://www.cnblogs.com/gugupluto/ 7 | // Copyright (c) 2014年 zc. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // UISegmentNavigationTest 4 | // 5 | // Created by gugupluto on 14-2-21. 6 | // http://www.cnblogs.com/gugupluto/ 7 | // Copyright (c) 2014年 zc. All rights reserved. 8 | // 9 | 10 | #import "AppDelegate.h" 11 | #import "GuGuSegmentNaviViewController.h" 12 | #import "ViewController.h" 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | // Override point for customization after application launch. 18 | NSArray *titleArray = [NSArray arrayWithObjects:@"轻松一刻",@"头条",@"北京",@"房产",@"移动互联",@"财经",@"科技",@"游戏",@"历史",@"军事",@"大满贯", nil]; 19 | 20 | NSMutableArray *controllerArray = [[NSMutableArray alloc]init]; 21 | 22 | for (NSString* title in titleArray) 23 | { 24 | ViewController *vc = [[ViewController alloc]init]; 25 | vc.labelTitle = [title stringByAppendingString:@" View Controller"]; 26 | [controllerArray addObject:vc]; 27 | } 28 | 29 | GuGuSegmentNaviViewController *controller = [[ GuGuSegmentNaviViewController alloc]initWithItems:titleArray andControllers:controllerArray]; 30 | 31 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:controller]; 32 | 33 | self.window.rootViewController = nav; 34 | return YES; 35 | } 36 | 37 | - (void)applicationWillResignActive:(UIApplication *)application 38 | { 39 | // 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. 40 | // 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. 41 | } 42 | 43 | - (void)applicationDidEnterBackground:(UIApplication *)application 44 | { 45 | // 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. 46 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 47 | } 48 | 49 | - (void)applicationWillEnterForeground:(UIApplication *)application 50 | { 51 | // 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. 52 | } 53 | 54 | - (void)applicationDidBecomeActive:(UIApplication *)application 55 | { 56 | // 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. 57 | } 58 | 59 | - (void)applicationWillTerminate:(UIApplication *)application 60 | { 61 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/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 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/GuGuLandscapeTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuLandscapeTableView.h 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GuGuSegmentBarView.h" 11 | 12 | 13 | @interface GuGuLandscapeTableView : UIView 14 | { 15 | UITableView *tableView; 16 | } 17 | @property(nonatomic,retain)NSArray *cellDataSource; 18 | - (void)reloadTableWithArray:(NSArray*)array; 19 | - (id)initWithFrame:(CGRect)frame Array:(NSArray*)array; 20 | -(void)selectIndex:(int)index; 21 | 22 | @property(nonatomic,unsafe_unretained)idswipeDelegate; 23 | @end 24 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/GuGuLandscapeTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuLandscapeTableView.m 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import "GuGuLandscapeTableView.h" 10 | 11 | @implementation GuGuLandscapeTableView 12 | @synthesize cellDataSource; 13 | @synthesize swipeDelegate; 14 | - (id)initWithFrame:(CGRect)frame Array:(NSArray*)array 15 | { 16 | self = [super init]; 17 | if (self) 18 | { 19 | self.frame = frame; 20 | 21 | self.backgroundColor = [UIColor redColor]; 22 | tableView = [[UITableView alloc]initWithFrame:self.bounds]; 23 | tableView.delegate = self; 24 | tableView.dataSource = self; 25 | tableView.scrollsToTop = NO; 26 | tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 27 | tableView.transform = CGAffineTransformMakeRotation(-M_PI/2); 28 | tableView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); 29 | tableView.showsVerticalScrollIndicator = NO; 30 | tableView.pagingEnabled = YES; 31 | tableView.backgroundColor = [UIColor colorWithRed:192/256.0 green:192/256.0 blue:192/256.0 alpha:1.0]; 32 | tableView.bounces =YES; 33 | [self addSubview:tableView]; 34 | self.cellDataSource = array; 35 | 36 | } 37 | return self; 38 | } 39 | 40 | 41 | - (void)reloadTableWithArray:(NSArray*)array 42 | { 43 | if (array && array.count >0) 44 | { 45 | self.cellDataSource = array; 46 | [tableView reloadData]; 47 | } 48 | } 49 | #pragma mark Table view methods 50 | 51 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 52 | { 53 | return self.frame.size.width; 54 | } 55 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 56 | { 57 | NSInteger rowCount = self.cellDataSource.count; 58 | 59 | return rowCount; 60 | } 61 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 62 | 63 | static NSString *CellIdentifier = @"ViewCell"; 64 | 65 | UITableViewCell *cell = nil; 66 | if (cell == nil) 67 | { 68 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier ] ; 69 | cell.contentView.backgroundColor=[UIColor clearColor]; 70 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 71 | cell.transform = CGAffineTransformMakeRotation(M_PI/2); 72 | 73 | UIViewController *vc = [cellDataSource objectAtIndex:[indexPath row]]; 74 | vc.view.frame = cell.bounds; 75 | [cell.contentView addSubview: vc.view]; 76 | } 77 | return cell; 78 | } 79 | 80 | -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView 81 | { 82 | if (self.swipeDelegate != nil && [self.swipeDelegate respondsToSelector:@selector(contentSelectedIndexChanged:)]) 83 | { 84 | int index = tableView.contentOffset.y / self.frame.size.width; 85 | [self.swipeDelegate contentSelectedIndexChanged:index]; 86 | } 87 | } 88 | 89 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 90 | { 91 | CGPoint pt = tableView.contentOffset; 92 | [self.swipeDelegate scrollOffsetChanged:pt]; 93 | } 94 | 95 | -(void)selectIndex:(int)index 96 | { 97 | [tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO]; 98 | } 99 | @end 100 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/GuGuSegmentBarView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentBarView.h 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import 10 | #define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] 11 | 12 | @protocol GuGuIndexDelegate 13 | 14 | @optional 15 | -(void)barSelectedIndexChanged:(int)newIndex; 16 | -(void)contentSelectedIndexChanged:(int)newIndex; 17 | -(void)scrollOffsetChanged:(CGPoint)offset; 18 | 19 | @end 20 | @interface GuGuSegmentBarView : UIScrollView 21 | -(id)initWithFrame:(CGRect)frame andItems:(NSArray*)titleArray; 22 | -(void)setLineOffsetWithPage:(float)page andRatio:(float)ratio; 23 | -(void)selectIndex:(int)index; 24 | @property(nonatomic,assign)int selectedIndex; 25 | @property(nonatomic,unsafe_unretained)idclickDelegate; 26 | @end 27 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/GuGuSegmentBarView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentBarView.m 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import "GuGuSegmentBarView.h" 10 | #define kButtonTagStart 100 11 | @interface GuGuSegmentBarView () 12 | { 13 | UIView *lineView; 14 | NSMutableArray *buttonArray; 15 | } 16 | @end 17 | 18 | @implementation GuGuSegmentBarView 19 | @synthesize selectedIndex; 20 | @synthesize clickDelegate; 21 | - (id)initWithFrame:(CGRect)frame 22 | { 23 | self = [super initWithFrame:frame]; 24 | if (self) { 25 | // Initialization code 26 | 27 | } 28 | return self; 29 | } 30 | 31 | -(id)initWithFrame:(CGRect)frame andItems:(NSArray*)titleArray 32 | { 33 | self = [super initWithFrame:frame]; 34 | if (self) { 35 | // Initialization code 36 | 37 | selectedIndex = 0; 38 | int width = 0; 39 | buttonArray = [[NSMutableArray alloc]init]; 40 | for (int i = 0 ; i < titleArray.count; i++) 41 | { 42 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 43 | button.backgroundColor = [UIColor clearColor]; 44 | button.titleLabel.font = [UIFont systemFontOfSize:15]; 45 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 46 | NSString *title = [titleArray objectAtIndex:i]; 47 | [button setTitle:title forState:UIControlStateNormal]; 48 | button.tag = kButtonTagStart+i; 49 | CGSize size = [title sizeWithFont:[UIFont systemFontOfSize:15] constrainedToSize:CGSizeMake(MAXFLOAT, 25) lineBreakMode:NSLineBreakByWordWrapping]; 50 | button.frame = CGRectMake(width, 0, size.width, 25); 51 | [button addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside]; 52 | [self addSubview:button]; 53 | [buttonArray addObject:button]; 54 | width += size.width+20; 55 | 56 | } 57 | self.contentSize = CGSizeMake(width, 25); 58 | self.showsHorizontalScrollIndicator = NO; 59 | 60 | 61 | CGRect rc = [self viewWithTag:selectedIndex+kButtonTagStart].frame; 62 | lineView = [[UIView alloc]initWithFrame:CGRectMake(rc.origin.x, self.frame.size.height - 2, rc.size.width, 2)]; 63 | lineView.backgroundColor = RGBCOLOR(190, 2, 1); 64 | [self addSubview:lineView]; 65 | } 66 | return self; 67 | 68 | 69 | 70 | } 71 | 72 | -(void)onClick:(id)sender 73 | { 74 | UIButton *btn = (UIButton*)sender; 75 | if (selectedIndex != btn.tag - kButtonTagStart) 76 | { 77 | [self selectIndex:(int)(btn.tag - kButtonTagStart)]; 78 | } 79 | 80 | } 81 | 82 | -(void)selectIndex:(int)index 83 | { 84 | if (selectedIndex != index) 85 | { 86 | selectedIndex = index; 87 | [UIView beginAnimations:@"" context:nil]; 88 | [UIView setAnimationDuration:0.2]; 89 | CGRect lineRC = [self viewWithTag:selectedIndex+kButtonTagStart].frame; 90 | lineView.frame = CGRectMake(lineRC.origin.x, self.frame.size.height - 2, lineRC.size.width, 2); 91 | [UIView commitAnimations]; 92 | 93 | if (clickDelegate != nil && [clickDelegate respondsToSelector:@selector(barSelectedIndexChanged:)]) 94 | { 95 | [clickDelegate barSelectedIndexChanged:selectedIndex]; 96 | } 97 | 98 | 99 | if (lineRC.origin.x - self.contentOffset.x > 320 * 2 / 3) 100 | { 101 | int index = selectedIndex; 102 | if (selectedIndex + 2 < buttonArray.count) 103 | { 104 | index = selectedIndex + 2; 105 | } 106 | else if (selectedIndex + 1 < buttonArray.count) 107 | { 108 | index = selectedIndex + 1; 109 | } 110 | CGRect rc = [self viewWithTag:index +kButtonTagStart].frame; 111 | [self scrollRectToVisible:rc animated:YES]; 112 | } 113 | else if ( lineRC.origin.x - self.contentOffset.x < 320 / 3) 114 | { 115 | int index = selectedIndex; 116 | if (selectedIndex - 2 >= 0) 117 | { 118 | index = selectedIndex - 2; 119 | } 120 | else if (selectedIndex - 1 >= 0) 121 | { 122 | index = selectedIndex - 1; 123 | } 124 | CGRect rc = [self viewWithTag:index +kButtonTagStart].frame; 125 | [self scrollRectToVisible:rc animated:YES]; 126 | } 127 | 128 | 129 | } 130 | 131 | } 132 | 133 | -(void)setLineOffsetWithPage:(float)page andRatio:(float)ratio 134 | { 135 | 136 | 137 | CGRect lineRC = [self viewWithTag:page+kButtonTagStart].frame; 138 | 139 | CGRect lineRC2 = [self viewWithTag:page+1+kButtonTagStart].frame; 140 | 141 | float width = lineRC2.size.width; 142 | if (lineRC2.size.width < lineRC.size.width) 143 | { 144 | width = lineRC.size.width - (lineRC.size.width-lineRC2.size.width)*ratio; 145 | 146 | } 147 | else if(lineRC2.size.width > lineRC.size.width) 148 | { 149 | width = lineRC.size.width + (lineRC2.size.width-lineRC.size.width)*ratio; 150 | } 151 | float x = lineRC.origin.x + (lineRC2.origin.x - lineRC.origin.x)*ratio; 152 | 153 | 154 | lineView.frame = CGRectMake(x, self.frame.size.height - 2,width, 2); 155 | 156 | 157 | 158 | } 159 | 160 | 161 | 162 | 163 | /* 164 | // Only override drawRect: if you perform custom drawing. 165 | // An empty implementation adversely affects performance during animation. 166 | - (void)drawRect:(CGRect)rect 167 | { 168 | // Drawing code 169 | } 170 | */ 171 | 172 | @end 173 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/GuGuSegmentNaviViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentNaviViewController.h 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GuGuSegmentBarView.h" 11 | @interface GuGuSegmentNaviViewController : UIViewController 12 | { 13 | 14 | } 15 | -(id)initWithItems:(NSArray*)titleArray andControllers:(NSArray*)controllers; 16 | @end 17 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/GuGuSegmentNaviViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // GuGuSegmentNaviViewController.m 3 | // 4 | // Created by gugupluto on 14-2-21. 5 | // http://www.cnblogs.com/gugupluto/ 6 | // Copyright (c) 2014年 gugupluto. All rights reserved. 7 | // 8 | 9 | #import "GuGuSegmentNaviViewController.h" 10 | #import "GuGuSegmentBarView.h" 11 | #import "GuGuLandscapeTableView.h" 12 | 13 | #define kBarHeight 27 14 | @interface GuGuSegmentNaviViewController () 15 | { 16 | int currentIndex; 17 | NSArray *_titleArray; 18 | GuGuLandscapeTableView *contentTable; 19 | GuGuSegmentBarView *barView ; 20 | } 21 | @end 22 | 23 | @implementation GuGuSegmentNaviViewController 24 | 25 | -(id)initWithItems:(NSArray*)titleArray andControllers:(NSArray*)controllers 26 | { 27 | self = [super init]; 28 | if (self) 29 | { 30 | NSString * tmpVersonType = [UIDevice currentDevice].systemVersion; 31 | 32 | NSArray * tmpArr = [tmpVersonType componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"."]]; 33 | int y = 0; 34 | if([[tmpArr objectAtIndex:0] isEqualToString:@"7"]) 35 | { 36 | self.automaticallyAdjustsScrollViewInsets = NO; 37 | y = 64; 38 | } 39 | 40 | barView = [[GuGuSegmentBarView alloc]initWithFrame:CGRectMake(0, y, 320, kBarHeight) andItems:titleArray]; 41 | 42 | barView.backgroundColor = RGBCOLOR(230, 230, 230); 43 | [self.view addSubview:barView]; 44 | barView.clickDelegate = self; 45 | self.view.backgroundColor = [UIColor whiteColor]; 46 | contentTable = [[GuGuLandscapeTableView alloc]initWithFrame:CGRectMake(0, kBarHeight + y, 320, self.view.frame.size.height - kBarHeight - y) Array:controllers]; 47 | contentTable.swipeDelegate = self; 48 | 49 | [self.view addSubview:contentTable]; 50 | 51 | 52 | if (controllers.count > 0) 53 | { 54 | for (UIViewController *controller in controllers) 55 | { 56 | //[self addChildViewController:controller]; 57 | } 58 | currentIndex = 0; 59 | } 60 | _titleArray = titleArray; 61 | } 62 | return self; 63 | } 64 | 65 | 66 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 67 | { 68 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 69 | if (self) { 70 | // Custom initialization 71 | 72 | } 73 | return self; 74 | } 75 | 76 | - (void)viewDidLoad 77 | { 78 | [super viewDidLoad]; 79 | self.title = [_titleArray objectAtIndex:0]; 80 | 81 | // Do any additional setup after loading the view. 82 | } 83 | 84 | - (void)didReceiveMemoryWarning 85 | { 86 | [super didReceiveMemoryWarning]; 87 | // Dispose of any resources that can be recreated. 88 | } 89 | 90 | -(void)barSelectedIndexChanged:(int)newIndex 91 | { 92 | if (newIndex >= 0) 93 | { 94 | currentIndex = newIndex; 95 | self.title = [_titleArray objectAtIndex:newIndex]; 96 | [contentTable selectIndex:newIndex]; 97 | } 98 | } 99 | 100 | -(void)contentSelectedIndexChanged:(int)newIndex 101 | { 102 | [barView selectIndex:newIndex]; 103 | } 104 | 105 | -(void)scrollOffsetChanged:(CGPoint)offset 106 | { 107 | int page = (int)offset.y / 320 ; 108 | float radio = (float)((int)offset.y % 320)/320; 109 | [barView setLineOffsetWithPage:page andRatio:radio]; 110 | } 111 | 112 | 113 | 114 | 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/UISegmentNavigationTest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | zc.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/UISegmentNavigationTest-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // UISegmentNavigationTest 4 | // 5 | // Created by gugupluto on 14-2-21. 6 | // http://www.cnblogs.com/gugupluto/ 7 | // Copyright (c) 2014年 zc. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @property(nonatomic,retain)NSString *labelTitle; 15 | @end 16 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // UISegmentNavigationTest 4 | // 5 | /// Created by gugupluto on 14-2-21. 6 | // http://www.cnblogs.com/gugupluto/ 7 | // Copyright (c) 2014年 zc. All rights reserved. 8 | // 9 | 10 | #import "ViewController.h" 11 | #import "GuGuSegmentBarView.h" 12 | 13 | @interface ViewController () 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | @synthesize labelTitle; 19 | - (void)viewDidLoad 20 | { 21 | 22 | [super viewDidLoad]; 23 | int r = rand() % 255; 24 | int b = rand() % 255; 25 | self.view.backgroundColor = RGBCOLOR(r,255, b); 26 | UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 200, 320, 30)]; 27 | label.textAlignment = NSTextAlignmentCenter; 28 | label.text = self.labelTitle; 29 | label.backgroundColor = [UIColor clearColor]; 30 | [self.view addSubview:label]; 31 | 32 | 33 | return; 34 | 35 | // Do any additional setup after loading the view, typically from a nib. 36 | } 37 | 38 | - (void)didReceiveMemoryWarning 39 | { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | -(void)dealloc 45 | { 46 | 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // UISegmentNavigationTest 4 | // 5 | // Created by zc on 14-2-21. 6 | // Copyright (c) 2014年 zc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTestTests/UISegmentNavigationTestTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | zc.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTestTests/UISegmentNavigationTestTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentNavigationTestTests.m 3 | // UISegmentNavigationTestTests 4 | // 5 | // Created by zc on 14-2-21. 6 | // Copyright (c) 2014年 zc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UISegmentNavigationTestTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation UISegmentNavigationTestTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Sample/UISegmentNavigationTestTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------