YANScrollMenu 1.0.1

YANScrollMenu 1.0.1

测试测试通过
语言语言 Obj-CObjective C
许可证 MIT
发布时间上一次发布2017年9月

Yan[YAN] 维护。



 
依赖项
SDWebImage= 3.8.2
Masonry= 1.0.2
 

  • 作者
  • yanfj

YANScrollMenu|中文文档

GIF

要求

  • ARC
  • iOS 8.0+

使用方法

1. 导入类

#import "YANScrollMenu.h"

2. 直接像设置一个普通的UIView那样初始化一个 YANScrollMenu

self.menu = [[YANScrollMenu alloc] initWithFrame:CGRectMake(0, 0, 375,150) delegate:self];
# add to view
[self.view addSubview:self.menu];
    
# you can also set to be a tableHeaderView
self.tableView.tableHeaderView = self.menu;

3. 必须采用 YANScrollMenuDataSource

# the number of items in each section
- (NSUInteger)scrollMenu:(YANScrollMenu *)menu numberOfItemsInSection:(NSInteger)section;

# the number of section
- (NSUInteger)numberOfSectionsInScrollMenu:(YANScrollMenu *)menu;

# the dataSource of item
- (id<YANObjectProtocol>)scrollMenu:(YANScrollMenu *)scrollMenu objectAtIndexPath:(NSIndexPath *)indexPath;

4. 《YANScrollMenuDelegate》中也有一些可以用来定制的函数

# the size of item 
- (CGSize)itemSizeOfScrollMenu:(YANScrollMenu *)menu;
   
# the customize view to set to be the header  in each section
- (UIView *)scrollMenu:(YANScrollMenu *)menu headerInSection:(NSUInteger)section;
 
# the height of header    
- (CGFloat)heightOfHeaderInScrollMenu:(YANScrollMenu *)menu;
   
# the height of pageControl  
- (CGFloat)heightOfPageControlInScrollMenu:(YANScrollMenu *)menu;

# automatic update frame or not
- (BOOL)shouldAutomaticUpdateFrameInScrollMenu:(YANScrollMenu *)menu;
   
# the callback when the item did selected  
- (void)scrollMenu:(YANScrollMenu *)menu didSelectItemAtIndexPath:(NSIndexPath *)indexPath;

5. 自定义外观

# the icon size of item
[[YANMenuItem appearance] setIconSize:30];

# the cornerRadius of icon
[[YANMenuItem appearance] setIconCornerRadius:15];

# the textFont of the  label
[[YANMenuItem appearance] setTextFont:[UIFont systemFontOfSize:12]];

# the textColor of the  label
[[YANMenuItem appearance] setTextColor:[UIColor darkTextColor]];

# the space between icon and label
[[YANMenuItem appearance] setSpace:5];

依赖项

YANScrollMenu 依赖于 SDWebImageMasonry. 注意:当 SDWebImage 的版本大于 3.8.2 时,将不支持 gif。

发布说明

  • V 1.0.1 仓库已经改变
  • V 1.0.0 框架已重构
  • V 0.9.1 修复一些错误并优化了代码
  • V 0.9.0 首次发布

许可证

YANScrollMenu 根据 MIT 许可证发布。请参阅 LICENSE 文件以获取详细信息。

联系方式

有任何建议或问题?请创建一个 GitHub 问题 。