FDSlideBar

所属分类:其他
开发工具:Objective-C
文件大小:0KB
下载次数:0
上传日期:2018-01-26 07:30:45
上 传 者sh-1993
说明:  与iOS.中使用的NTES新闻客户端的顶部幻灯片菜单类似的自定义滑动条。,
(A custom slide bar like the top slide menu of NTES news client used in iOS.,)

文件列表:
FDSlideBar.podspec (6704, 2015-08-13)
FDSlideBarDemo/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo.xcodeproj/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo.xcodeproj/project.pbxproj (20022, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo.xcodeproj/project.xcworkspace/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata (135, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/AppDelegate.h (286, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/AppDelegate.m (2040, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/Base.lproj/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/Base.lproj/LaunchScreen.xib (3712, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/Base.lproj/Main.storyboard (1705, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/FDSlideBar/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/FDSlideBar/FDSlideBar.h (860, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/FDSlideBar/FDSlideBar.m (7314, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/FDSlideBar/FDSlideBarItem.h (740, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/FDSlideBar/FDSlideBarItem.m (3721, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/FDSlideContentView.h (1078, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/FDSlideContentView.m (2867, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/Images.xcassets/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/Images.xcassets/AppIcon.appiconset/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/Images.xcassets/AppIcon.appiconset/Contents.json (1077, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/Info.plist (1574, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/ViewController.h (230, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/ViewController.m (4262, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/controllers(deprecated)/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/controllers(deprecated)/NewsViewController.h (289, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/controllers(deprecated)/NewsViewController.m (971, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/controllers(deprecated)/NewsViewController.xib (2328, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/controllers(deprecated)/ViewController.h (224, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/controllers(deprecated)/ViewController.m (2608, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemo/main.m (343, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemoTests/ (0, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemoTests/FDSlideBarDemoTests.m (889, 2015-08-13)
FDSlideBarDemo/FDSlideBarDemoTests/Info.plist (749, 2015-08-13)
FDSlideBarDemo/TableViewCell.h (267, 2015-08-13)
FDSlideBarDemo/TableViewCell.m (618, 2015-08-13)
FDSlideBarDemo/TableViewCell.xib (2570, 2015-08-13)
LICENSE (1068, 2015-08-13)
... ...

# FDSlideBar A custom slide bar like the top slide menu of NTES news client used in iOS. # Introduction FDSlideBar is a sliding bar which is muck like the top menu bar of NTES news client. it can scroll the bar and content automaticly with smoth animation. It uses block to receive your deal when you select a itme or scroll the content view to previous or next page. It also support you to set some style such as backgroundColor, font size, text color, selected font size and selected text color and so on. Now I achieve the content by using table view. so it will benefit much from table view, there will be no memory problem and the original animation will surpport better. ## Preview ![preview](http://7xiamc.com1.z0.glb.clouddn.com/效果.gif) ## ScreenShot ![one](http://7xiamc.com1.z0.glb.clouddn.com/one.png) ![two](http://7xiamc.com1.z0.glb.clouddn.com/two.png) # Get started 1. Download the source file in the folder FDSlideBar. 2. Add the FDSlideBar.h and FDSlideBar.m files to your project. 3. Import the FDSlideBar.h file where you want to use it. The new achievement will advise you to use it with table view. # Usage - There are the key code, others you must read them in the demo for the detail. ## FDSlideBar ```Objective-C FDSlideBar *sliderBar = [[FDSlideBar alloc] init]; sliderBar.backgroundColor = [UIColor colorWithRed:0 / 255.0 green:128 / 255.0 blue:128 / 255.0 alpha:1.0]; // Init the titles of all the item sliderBar.itemsTitle = @[@"要闻", @"视频", @"上海", @"娱乐", @"体育NBA", @"财经", @"科技", @"社会", @"军事", @"时尚", @"汽车", @"游戏", @"图片", @"股票"]; // Set some style to the slideBar sliderBar.itemColor = [UIColor whiteColor]; sliderBar.itemSelectedColor = [UIColor orangeColor]; sliderBar.sliderColor = [UIColor orangeColor]; // Add the callback with the action that any item be selected [sliderBar slideBarItemSelectedCallback:^(NSUInteger idx) { [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO]; }]; [self.view addSubview:sliderBar]; _slideBar = sliderBar; ``` ## Setup TableView ```Objective-C // The frame of tableView, be care the width and height property CGRect frame = CGRectMake(0, 0, CGRectGetMaxY(self.view.frame) - CGRectGetMaxY(self.slideBar.frame), CGRectGetWidth(self.view.frame)); self.tableView = [[UITableView alloc] initWithFrame:frame]; [self.view addSubview:self.tableView]; // Register the custom cell UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; [self.tableView registerNib:nib forCellReuseIdentifier:@"ContentCell"]; // Set the tableView center in the bottom of view. so after rotating, it shows rightly self.tableView.center = CGPointMake(CGRectGetWidth(self.view.frame) * 0.5, CGRectGetHeight(self.view.frame) * 0.5 + CGRectGetMaxY(self.slideBar.frame) * 0.5); self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // Rotate the tableView 90 angle anticlockwise self.tableView.transform = CGAffineTransformMakeRotation(-M_PI_2); self.tableView.showsVerticalScrollIndicator = NO; self.tableView.pagingEnabled = YES; self.tableView.dataSource = self; self.tableView.delegate = self; ``` ## Setup TableView Cell ```Objective-C - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { TableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"ContentCell"]; // Rotate the cell's content 90 angle clockwise to show them rightly cell.contentView.transform = CGAffineTransformMakeRotation(M_PI_2); cell.text = self.slideBar.itemsTitle[indexPath.row]; return cell; } ``` #License MIT

近期下载者

相关文件


收藏者