iOS頂部滑動菜單:FDSlideBar 與NinaPagerView


FDSlideBar 是一個頂部滑動菜單,如常見的網易、騰訊新聞等樣式。該控件支持自定顏色、字體等多種樣式風格。菜單間切換流暢,具有較好的體驗性。下部的內容展示經過掙 扎,最后選擇了 UITableView 實現,從而很好地解決了ScrollView的內存問題,也獲得了很好地原生滑動效果。 

 

  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;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM