iOS頂部滑動菜單:FDSlideBar
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;

本文由用戶 mmntt 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!