自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

頂部滑動(dòng)菜單FDSlideBar

移動(dòng)開發(fā)
FDSlideBar是一個(gè)頂部滑動(dòng)菜單,如常見的網(wǎng)易、騰訊新聞等樣式。該控件支持自定顏色、字體等多種樣式風(fēng)格。

源碼簡介:FDSlideBar是一個(gè)頂部滑動(dòng)菜單,如常見的網(wǎng)易、騰訊新聞等樣式。該控件支持自定顏色、字體等多種樣式風(fēng)格。菜單間切換流暢,具有較好的體驗(yàn)性。下部的內(nèi)容展示經(jīng)過掙扎,***選擇了UITableView實(shí)現(xiàn),從而很好地解決了ScrollView的內(nèi)存問題,也獲得了很好地原生滑動(dòng)效果。

測試環(huán)境:Xcode 6.2,iOS 6.0以上

源碼截圖:

[[140891]]

源碼片段:

  1. FDSlideBar *sliderBar = [[FDSlideBar alloc] init]; 
  2.     sliderBar.backgroundColor = [UIColor colorWithRed:0 / 255.0 green:128 / 255.0 blue:128 / 255.0 alpha:1.0]; 
  3.  
  4.     // Init the titles of all the item 
  5.     sliderBar.itemsTitle = @[@"要聞", @"視頻", @"上海", @"娛樂", @"體育NBA", @"財(cái)經(jīng)", @"科技", @"社會(huì)", @"軍事", @"時(shí)尚", @"汽車", @"游戲", @"圖片", @"股票"]; 
  6.  
  7.     // Set some style to the slideBar 
  8.     sliderBar.itemColor = [UIColor whiteColor]; 
  9.     sliderBar.itemSelectedColor = [UIColor orangeColor]; 
  10.     sliderBar.sliderColor = [UIColor orangeColor]; 
  11.  
  12.     // Add the callback with the action that any item be selected 
  13.     [sliderBar slideBarItemSelectedCallback:^(NSUInteger idx) { 
  14.         [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO]; 
  15.     }]; 
  16.     [self.view addSubview:sliderBar]; 
  17.     _slideBar = sliderBar; 
  1. // The frame of tableView, be care the width and height property 
  2.    CGRect frame = CGRectMake(00, CGRectGetMaxY(self.view.frame) - CGRectGetMaxY(self.slideBar.frame), CGRectGetWidth(self.view.frame)); 
  3.    self.tableView = [[UITableView alloc] initWithFrame:frame]; 
  4.    [self.view addSubview:self.tableView]; 
  5.  
  6.    // Register the custom cell 
  7.    UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; 
  8.    [self.tableView registerNib:nib forCellReuseIdentifier:@"ContentCell"]; 
  9.  
  10.    // Set the tableView center in the bottom of view. so after rotating, it shows rightly 
  11.    self.tableView.center = CGPointMake(CGRectGetWidth(self.view.frame) * 0.5, CGRectGetHeight(self.view.frame) * 0.5 + CGRectGetMaxY(self.slideBar.frame) * 0.5); 
  12.    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
  13.  
  14.    // Rotate the tableView 90 angle anticlockwise 
  15.    self.tableView.transform = CGAffineTransformMakeRotation(-M_PI_2); 
  16.    self.tableView.showsVerticalScrollIndicator = NO; 
  17.    self.tableView.pagingEnabled = YES; 
  18.    self.tableView.dataSource = self; 
  19.    self.tableView.delegate = self; 
  1.  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
  2.     TableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"ContentCell"]; 
  3.  
  4.     // Rotate the cell's content 90 angle clockwise to show them rightly 
  5.     cell.contentView.transform = CGAffineTransformMakeRotation(M_PI_2); 
  6.     cell.text = self.slideBar.itemsTitle[indexPath.row]; 
  7.     return cell; 

下載地址:http://down.51cto.com/data/2068577

責(zé)任編輯:倪明
相關(guān)推薦

2011-09-06 14:36:34

觸摸菜單ipad應(yīng)用電子點(diǎn)菜

2009-07-15 13:31:51

Swing菜單和菜單項(xiàng)

2015-09-22 10:49:40

Android滑動(dòng)漸變

2015-07-20 15:14:19

側(cè)滑菜單功能多樣

2014-12-30 11:55:21

android開源

2014-04-15 10:34:38

Ubuntu 14.0

2014-12-31 14:52:27

SwipeMenuLiSwipeMenu

2012-06-07 09:25:31

Visual Stud

2015-10-20 15:54:16

android源碼滑動(dòng)關(guān)閉

2024-07-01 08:19:56

2010-09-03 10:58:45

DIVCSS

2021-07-21 05:31:39

Windows 11操作系統(tǒng)微軟

2015-02-12 15:33:43

微信SDK

2015-02-26 18:18:15

動(dòng)畫菜單Animation c

2010-01-27 10:21:00

Android菜單

2015-10-08 16:51:56

旋轉(zhuǎn)菜單動(dòng)畫

2021-11-03 17:10:37

CSS sticky前端代碼

2015-02-12 15:38:26

微信SDK

2018-12-11 15:20:12

Windows 10超級用戶用戶菜單

2021-08-19 09:05:36

頂部導(dǎo)航左側(cè)導(dǎo)航瀏覽
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號